Last active
August 9, 2016 21:15
-
-
Save miguelmota/ca368acb4420223bf80f8e18d5712a56 to your computer and use it in GitHub Desktop.
Export Stickies as text on Mac OS X
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
# credit: http://apple.stackexchange.com/questions/59525/export-all-stickies-at-once-on-os-x-10-8 | |
osascript <<'APPLESCRIPT' | |
set theName to "" | |
set i to 0 | |
set n to {} | |
set L to {} | |
# prompt for output dir | |
set destFldr to (choose folder with prompt "Choose a destination folder:") as text | |
# hardcode output dir | |
#set destFldr to "/path/to/export/to/" as text | |
set mydestFldr to POSIX path of destFldr | |
tell application "Stickies" | |
activate | |
tell application "System Events" | |
tell application process "Stickies" | |
set L to name of every window | |
try | |
repeat with awindow in L | |
set m to value of text area 1 of scroll area 1 of window awindow | |
set i to i + 1 | |
set theName to "stickies" & "_" & i & ".txt" as string | |
set theFile to mydestFldr & theName | |
do shell script "/bin/echo " & quoted form of m & " > " & quoted form of theFile | |
end repeat | |
end try | |
end tell | |
end tell | |
# display dialog "done" | |
tell application "Finder" | |
activate | |
open destFldr | |
end tell | |
end tell | |
APPLESCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment