[texworks] SCRIPTING: get current poppler page number

Paul A Norman paul.a.norman at gmail.com
Thu Oct 21 12:39:02 CEST 2010


Dear Bruno,

Downloaded the Acrobat API

Found this reference for the Apple Event  called     open

We may not need the /A  I'm not sure.

Paul
...
open
Opens a document or documents.
Syntax
open [list of alias] invisible [boolean] options [string]Parameters

 open The document or documents to open.
invisible Whether the opened document should be hidden. Default is false.
options Optional parameter string of open actions.

On 21 October 2010 22:29, Bruno Voisin <bvoisin at me.com> wrote:
>
> Le 21 oct. 2010 à 10:37, Paul A Norman a écrit :
>
>> On Mac OS, you may use Apple events and AppleScript. Adobe Reader
>> supports only the following required Apple events:
>> ●open
>> ●print
>> ●quit
>> ●run
>>
>> Now unless ther is a way we can pass the options like page=NN to the
>> open "Apple event", this may be a dead end, does Ramón's  script below
>> look like this can be done please? (We probably don't want all the
>> screen placement stuff )
>>
>> [...]
>
> The following works (with Acrobat Pro) for opening the first page:
>
>        #!/bin/bash
>
>        PATH="$PATH:/usr/texbin:/usr/local/bin"
>
>        name=$(basename "$1" .pdf)
>        basefname="`pwd`/${name}"
>
>        /usr/bin/osascript  <<END
>        activate application "Adobe Acrobat Pro"
>        tell application "Adobe Acrobat Pro"
>               open POSIX file "$basefname.pdf"
>        end tell
>        END
>
> It certainly can be made better, for example the PATH setting at the beginning is probably superfluous (if you have TeX the path has already been set at install time) and the check for the file extension .pdf is also probably superfluous.
>
> I've tried to insert in the open command the code telling to open a specific page, for example page 2, as follows
>
>       open /A "page=2=OpenActions" POSIX file "$basefname.pdf"
>
> That doesn't work:
>
>        $ ./pdfopen somefile.pdf
>        93:94: syntax error: Expected end of line but found “"”. (-2741)
>
> That's where my competence in scripts ends.
>
> Bruno Voisin
>



More information about the texworks mailing list