Last active
December 22, 2015 08:29
-
-
Save derickfay/6445713 to your computer and use it in GitHub Desktop.
Strip the user home directory from a filename in Applescript
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
tell application "Skim" | |
set theFile to file of document 1 as string | |
set theHome to path to home folder as string | |
set theFilePath to my replaceText(theHome, "", theFile) | |
end tell | |
on replaceText(find, replace, someText) | |
set prevTIDs to text item delimiters of AppleScript | |
set text item delimiters of AppleScript to find | |
set someText to text items of someText | |
set text item delimiters of AppleScript to replace | |
set someText to "" & someText | |
set text item delimiters of AppleScript to prevTIDs | |
return someText | |
end replaceText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment