Last active
November 7, 2020 04:17
-
-
Save zhaofeng-shu33/b65b396aba53471a4aaf9807f7578d73 to your computer and use it in GitHub Desktop.
applescript for texshop to open skim displayline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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