Skip to content

Instantly share code, notes, and snippets.

@evansde77
Last active August 29, 2015 13:56
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 evansde77/312f85478799f80af501 to your computer and use it in GitHub Desktop.
Save evansde77/312f85478799f80af501 to your computer and use it in GitHub Desktop.
Applescript that creates a new sticky with a colour based on a command line priority value, example usage: osascript /Users/david/Documents/open-sticky.scpt high "update monitoring for replication"
on run argv
set card_prior to item 1 of argv
set card_text to item 2 of argv
if card_prior is equal to "high" then
set colour to "pink"
else if card_prior is equal to "medium" then
set colour to "blue"
else if card_prior is equal to "low" then
set colour to "green"
else
set colour to "yellow"
end if
tell application "Stickies" to activate
tell application "System Events"
tell process "Stickies"
tell window 1
delay 1
keystroke "n" using command down
tell scroll area 1
set value of text area 1 to card_text
delay 0.5
end tell
end tell
click menu item colour of menu "Color" of menu bar 1
end tell
end tell
end run
function new-card {
local PRIORITY="${1}"
shift;
local CONTENT=$@
osascript $HOME/Documents/open-sticky.scpt $PRIORITY "$CONTENT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment