On Feb 19, 2012, at 23:04, Artemio González López wrote:

> After a little bit of experimenting, I think I've narrowed down the problem 
> down significantly. More specifically, I've now checked that the following DO 
> WORK:
> 
> 1)  Running an ApplesScript script like the following directly from Script 
> Editor:
> 
> set theFile to POSIX file "/Users/artemio/Desktop/Apuntes/MC.pdf"
> set theSource to POSIX file "/Users/artemio/Desktop/Apuntes/chap2.tex"
> tell application "Skim"
>       activate
>       open theFile
>       tell front document to go to TeX line 100 from theSource
> end tell
> 
> 2) Running the following equivalent shell script from the Terminal:
> 
> /usr/bin/osascript \
>   -e 'set theFile to POSIX file "/Users/artemio/Desktop/Apuntes/MC.pdf"' \
>   -e 'set theSource to POSIX file "/Users/artemio/Desktop/Apuntes/chap2.tex"' 
> \
>   -e 'tell application "Skim"' \
>   -e 'activate' \
>   -e 'open theFile' \
>   -e 'tell front document to go to TeX line 1000 from theSource' \
>   -e 'end tell'
> 
> 
> Therefore, it seems to me that displayline fails when the arguments are 
> passed to bin/echo as null-separated strings. Indeed, the error after running 
> a command like " .../displayline line 100 foo.pdf foo.tex" at the Terminal is
> 
> 102:160: execution error: Can’t get item 1 of {}. (-1728)
> 
> which seems to indicate that theArgv is empty. Is there any reasonable way to 
> fix this?
> 
> Thanks in advance,
> 
> Artemio
> 
> 
> Artemio González López
> [email protected]

What if you copy the displayline script and replace the last part as follows:

/usr/bin/osascript \
  -e "set theLine to ${line} as integer" \
  -e "set theFile to POSIX file \"${file}\"" \
  -e "set theSource to POSIX file \"${source}\"" \
  -e "set thePath to POSIX path of (theFile as alias)" \
  -e "tell application \"Skim\"" \
  -e "  if $activate then activate" \
  -e "  if $revert then" \
  -e "    try" \
  -e "      set theDocs to get documents whose path is thePath" \
  -e "      if (count of theDocs) > 0 then revert theDocs" \
  -e "    end try" \
  -e "  end if" \
  -e "  open theFile" \
  -e "  tell front document to go to TeX line theLine from theSource showing 
reading bar $bar" \
  -e "end tell" -

and then use the copy?

Christiaan

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to