Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Send text from Quicksilver to Pushover (iOS) in a URL that will copy the text to the clipboard via Drafts, then redirect to Launch Center Pro. Special character safe.
-- I got some help for the curl part from https://gist.github.com/c99koder/6773332
property app_auth : "..."
property user_key : "..."
property drafts_key : "..."
using terms from application "Quicksilver"
on get direct types
return {"NSStringPboardType"}
end get direct types
on process text my_input
set title to "Sent to Clipboard from Quicksilver"
try
set quote_cmd to "usr/bin/env python -c 'import sys; import urllib2; print(urllib2.quote(sys.argv[1]))'"
set quoted to do shell script quote_cmd & " " & quoted form of my_input
set message to "drafts://x-callback-url/create?text=" & quoted & "&action=Copy%20to%20Clipboard&key=" & drafts_key & "&afterSuccess=Archive&x-success=launch:"
do shell script "curl --silent -F token=" & app_auth & " -F user=" & user_key & " -F title=" & quoted form of title & " -F message=" & quoted form of message & " https://api.pushover.net/1/messages.json > /dev/null"
on error a number b
activate
display dialog a with title "error with your QS action script"
end try
end process text
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment