Skip to content

Instantly share code, notes, and snippets.

View epramono's full-sized avatar

Eric Pramono epramono

View GitHub Profile
@epramono
epramono / AlfredToFelix
Created January 17, 2014 16:40
This AppleScript will accept `felix <item>` in Alfred and translate it to x-callback-url invocation on iOS - involving Command-C and Felix. Requires: Alfred 2 + Power Pack, Command-C 1.0, and Felix.
tell application "System Events"
set theDevice to my urlencode("Eric Pramono’s iPhone") as string
set theQuery to my urlencode("{query}") as string
set theURL to "command-c://x-callback-url/copyText?deviceName=" & theDevice & "&text=felix%3A%2F%2Fcompose%2Fpost%3Ftext%3D" & my urlencode(theQuery)
open location theURL
end tell
on urlencode(theurl)
@epramono
epramono / AlfredToMomento
Created January 17, 2014 16:39
This AppleScript will accept `momento <item>` in Alfred and translate it to x-callback-url invocation on iOS - involving Command-C and Momento. Requires: Alfred 2 + Power Pack, Command-C 1.0, and Momento.
tell application "System Events"
set theDevice to my urlencode("Eric Pramono’s iPhone") as string
set theQuery to my urlencode("{query}") as string
set theURL to "command-c://x-callback-url/copyText?deviceName=" & theDevice & "&text=momento%3A%2F%2Fcommand%2Fnewmoment%3Ftext%3D" & my urlencode(theQuery)
open location theURL
end tell
on urlencode(theurl)
@epramono
epramono / AddJournalItemIn1Writer
Last active January 3, 2016 14:29
This Drafts action will append a new item into 1Writer's local document named "Journal Items.md" with a timestamp. Requires: Drafts 3.5.4, 1Writer 1.2, and TextExpander.
onewriter://x-callback-url/append?
path=Documents&
type=local&
name=Journal%20Items.md&
text={{<<xdts>>}}%0A[[draft]]&
afterSuccess=Delete
@epramono
epramono / AlfredTo1Writer
Created January 17, 2014 16:33
This AppleScript will accept `journal <item>` in Alfred and translate it to x-callback-url invocation on iOS - involving Command-C and 1Writer. Requires: Alfred 2 + Power Pack, Command-C 1.0, and 1Writer 1.2
tell application "System Events"
set theDevice to my urlencode("Eric Pramono’s iPhone") as string
set theQuery to my urlencode("{query}") as string
set theURL to "command-c://x-callback-url/copyText?deviceName=" & theDevice & "&text=drafts%3A%2F%2Fx-callback-url%2Fcreate%3FafterSuccess%3DDelete%26action%3DAdd%2520Journal%2520Item%2520in%25201Writer%26text%3D" & my urlencode(theQuery)
open location theURL
end tell
on urlencode(theurl)
@epramono
epramono / AlfredToBegin
Created January 17, 2014 15:55
This AppleScript will accept `begin <todo-item>` in Alfred and translate it to x-callback-url invocation on iOS - involving Command-C and Begin. Requires: Alfred 2 + Power Pack, Command-C 1.0, and Begin.
tell application "System Events"
set theDevice to my urlencode("Eric Pramono’s iPhone") as string
set theQuery to my urlencode("{query}") as string
set theURL to "command-c://x-callback-url/copyText?deviceName=" & theDevice & "&text=beginapp%3A%2F%2Fx-callback-url%2FaddTasks%3Ftext%3D" & my urlencode(theQuery)
open location theURL
end tell
on urlencode(theurl)
@epramono
epramono / AlfredToQuotebook
Last active January 3, 2016 14:19
This AppleScript will accept `quote <author-name>` in Alfred and translate it to x-callback-url invocation on iOS - involving Command-C and Quotebook. It will retrieve the quote from the clipboard, and the quote source from the URL of the current active tab on Safari. Requires: Alfred 2 + Power Pack, Command-C 1.0, and Quotebook.
set theClipboard to the clipboard as string
set theQuote to my urlencode(theClipboard)
set theActiveURL to ""
tell application "Safari"
set theActiveWindow to first window
set theActiveTab to current tab of theActiveWindow
set theDecodedURL to URL of theActiveTab as string
set theActiveURL to my urlencode(theDecodedURL) as string
end tell
@epramono
epramono / AlfredToDrafts
Created January 17, 2014 15:45
This AppleScript will accept `drafts %1` or `drafts %1 %2` in Alfred and translate it to x-callback-url invocation on iOS - involving Command-C and Drafts. Requires: Alfred 2 + Power Pack, Command-C 1.0, and Drafts 2.5
tell application "System Events"
set theDevice to my urlencode("Eric Pramono’s iPhone") as string
set theQuery to "{query}"
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"; "}
set argv to my explode ("; ", theQuery) as list
set argcount to count of argv
if (argcount > 0)
@epramono
epramono / 1WriterSearchMultiSites
Created January 11, 2014 02:27
This 1Writer action allows you to take the currently selected text and sends it over to search for multiple sites on your Mac. Requires: 1Writer, Launch Center Pro 2.1, Drafts 3.5.4, TextExpander, Command-C 1.0. This action also requires a Drafts action to recursively open new tabs.
launch://x-callback-url/clipboard?
text={[text]}&
x-success=
drafts%3A%2F%2Fx-callback-url%2Fcreate%3F
text%3D%3Ccclipboard%3E%26
action%3DSearch%2520Multiple%2520Sites%26
allowEmpty%3DNO%26
afterSuccess%3DDelete
@epramono
epramono / LCPSearchMultiSite
Created January 10, 2014 18:22
This Launch Center Pro action takes your search keyword and use it to trigger web search on your Mac for multiple tabs at the same time. Requires: Launch Center Pro 2.1, TextExpander 2.3, and Drafts 3.5.4. (Note: this still requires another Drafts action to be created).
launch://x-callback-url/clipboard?
text={{[prompt-text:Search Keyword]}}&
x-success=
{{launch://?url=drafts%3A%2F%2Fx-callback-url%2Fcreate%3Ftext%3D
%3Ccclipboard%3E%26
action%3DSearch%2520Multiple%2520Sites%26
allowEmpty%3DNO%26
afterSuccess%3DDelete}}
@epramono
epramono / OpenMultiTabs
Created January 10, 2014 18:28
This is the Drafts action that will run recursively taking one URL at a time and sending it over to other Mac/iOS device. If the URL is an HTTP, then this action can be used to open multiple tabs in Safari for Mac.
command-c://x-callback-url/copyAndOpenURL?
deviceName={{Eric Pramono’s MacBook}}&
url=[[title]]&
x-source=Drafts&
x-success=
{{drafts://x-callback-url/create?
text=[[body]]&
action=Search%20Multiple%20Sites&
allowEmpty=NO&
afterSuccess=Delete}}