Skip to content

Instantly share code, notes, and snippets.

@evansde77 evansde77/gist:312f85478799f80af501 Secret
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.