Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read a text files contents as a variable
#3
Seeing that you are in an office environment the below alternative might not be usable/allowed.
I use sumatra pdf to open a pdf at a certain item or page, see below code.

Macro sumatra_open_pdf_at_page
Code:
Copy      Help
;How to use:
;1. Assign the correct content below in the variables "pdf_reader" , "pdf_file", "pagenumber" and "named_destination"
;;;;"named_destination" (line 11) is NOT neccessairy if you only want to test pagenumber navigation.
;2. Disable one of the below 'arg' strings, depending on what you want to test.
;;;;If you want to test the 'go to page number' (line 18) then disable the arg string below it (line 24).
;3. run this script

str pdf_reader=F".....\SumatraPDF.exe" ;; path to sumatra .exe
str pdf_file=".....pdf" ;; path to pdf file
int pagenumber=3 ;; pagenumber
str named_destination="''***''" ;; replace the *** to what you want to navigate to (note the DOUBLE QUOTES (double single quotes)). Best to first test an item from the TOC

;; ----  NAVIGATE TO TABLE OF CONTENT ENTRY
;; -named-dest <destination-name> :
;; Searches the first indicated file for a destination or a table-of-contents entry
;; (or starting with version 3.1 also a page label) matching destination-name and scrolls the document to it.
;; Combine with -reuse-instance if the document is already open.
str arg=F"''{pdf_file}'' -page {pagenumber} -reuse-instance"

;; ---- NAVIGATE TO PAGE
;; -page <pageNo> :
;; Scrolls the first indicated file to the indicated page.
;; Combine with -reuse-instance if the document is already open.
str arg=F"''{pdf_file}'' -named-dest {named_destination} -reuse-instance"


run pdf_reader arg ;; https://www.sumatrapdfreader.org/docs/Command-line-arguments.html


Messages In This Thread
RE: Read a text files contents as a variable - by r0n - 04-06-2019, 10:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)