Skip to content

Instantly share code, notes, and snippets.

@zhaofeng-shu33
Last active November 7, 2020 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhaofeng-shu33/b65b396aba53471a4aaf9807f7578d73 to your computer and use it in GitHub Desktop.
Save zhaofeng-shu33/b65b396aba53471a4aaf9807f7578d73 to your computer and use it in GitHub Desktop.
applescript for texshop to open skim displayline
--AppleScript direct
-- set val to do shell script "sed 's|[a-zA-Z]*.pdf|build/&|g' <<< " & quoted form of #PDFPATH#
-- tell application "Skim" to open val
set val to do shell script "sed 's|[a-zA-Z]*.pdf|build/&|g' <<< " & quoted form of #PDFPATH#
-- val is pdfpath
set lf to linefeed
tell application "TeXShop"
set offs to offset of the selection of document #DOCUMENTNAME#
set strt to text of document #DOCUMENTNAME#
end tell
set strt to characters 1 thru (offs) of strt as string
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to lf
set num to (count (text items of strt))
set AppleScript's text item delimiters to oldTIDs
-- tell application "Skim" to open val
do shell script "/Applications/Skim.app/Contents/SharedSupport/displayline " & num & " " & quoted form of val & " " & quoted form of #TEXPATH#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment