Created
July 4, 2014 13:30
-
-
Save dansheffler/4f8e7ee2c91c5f6ddbe6 to your computer and use it in GitHub Desktop.
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" | |
# Get current dimensions and font size of the currently | |
# selected note. | |
set theDocument to the front document | |
set filePath to the file of theDocument | |
set theNote to the active note of theDocument | |
set theBounds to the bounds of theNote | |
set noteWidth to the (third item of theBounds) - the (first item of theBounds) | |
set noteHeight to the (second item of theBounds) - the (fourth item of theBounds) | |
set theView to the view settings of theDocument | |
set fontSize to the font size of theNote | |
# Set the default font size for newly created notes. | |
set default note font sizes to {text note font size:fontSize} | |
delete theNote | |
quit saving yes # Skim needs to restart for the rest. | |
end tell | |
# Skim takes the default height and width of newly created notes | |
# from a hidden preference setting. So we need to set these two | |
# settings and restart Skim. | |
do shell script "defaults write -app Skim SKDefaultNoteWidth -float " & noteWidth | |
do shell script "defaults write -app Skim SKDefaultNoteHeight -float " & noteHeight | |
# Don't try to restart Skim before it has quit. | |
set isRunning to true | |
repeat while (isRunning) | |
delay 1 | |
tell application "System Events" | |
set isRunning to ((name of processes) contains "Skim") | |
end tell | |
end repeat | |
do shell script "open -a \"Skim\"" | |
# Reload the document with the way it looked when you quit. | |
tell application "Skim" | |
open filePath | |
set the view settings of the front document to theView | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment