run shell command with text as input

78 views
Skip to first unread message

aaronj1335

unread,
Aug 9, 2012, 3:26:11 PM8/9/12
to blacktree-...@googlegroups.com
i've got a sick little ruby script that allows you to make reminders from the command line like so:

$ echo 'party up this friday at 9' | make_reminder.rb

(it uses chronic to set the due date and rb-appscript to create the reminder).

i'd like to be able to open the bezel, type "." to enable text entry, and enter the event text ("party up this friday at 9" in this case), and have a 'create reminder' action show up in the right-hand pane.  the 'create reminder' action would essentially pass the text of the left-hand pane into stdin of `make_reminder.rb`.

how can i do this?

i know that i can create a service for all apps in automator which does this (passes the selected text into my `make_reminder.rb` script), and that works, but i can't get the service to show up in my actions (even though i can see it when i go to Quicksilver -> Preferences -> Preferences -> Actions -> Filter by Plugin -> Services Menu Plugin).

how can i use the text-entry-mode text as input for my `make_reminder.rb` script?

thanks!!!

Patrick Robertson

unread,
Aug 9, 2012, 3:33:18 PM8/9/12
to blacktree-...@googlegroups.com
I'd suggest putting this script inside an AppleScript, then placing the AppleScript inside

~/Library/Application Support/Quicksilver/Actions


See http://qsapp.com/wiki/AppleScripts#Pane_2_.28Action.29_AppleScripts for more info on how you might do this. Shouldn't be too difficult.

--
You received this message because you are subscribed to the Google Groups "Quicksilver" group.
To post to this group, send email to blacktree-...@googlegroups.com.
To unsubscribe from this group, send email to blacktree-quicks...@googlegroups.com.
Visit this group at http://groups.google.com/group/blacktree-quicksilver?hl=en.
 
 

Aaron Stacy

unread,
Aug 9, 2012, 3:46:05 PM8/9/12
to blacktree-...@googlegroups.com
sounds like this might work -- but how do i get the input in my applescript?  i.e., i've got the following `make_reminder.scpt`:

    do shell script "echo '" & input & "' | /Users/astacy/code/reminders/make_reminder.rb"

how do i set the 'input' variable to the contents of the Quicksilver text entry?

thanks!

Patrick Robertson

unread,
Aug 9, 2012, 3:50:18 PM8/9/12
to blacktree-...@googlegroups.com
Use

"on process text reminder" in your AppleScript

See the examples on the page I sent you, for example http://qsapp.com/wiki/SuperTweet_(AppleScript)

Aaron Stacy

unread,
Aug 9, 2012, 4:07:32 PM8/9/12
to blacktree-...@googlegroups.com
even better, just stumbled across this:


turns out i can just put my *.rb script in '~/Library/Application Support/Quicksilver/Actions' and use `ARGV[0]` instead of `ARGF.read`.

thanks again!

Patrick Robertson

unread,
Aug 9, 2012, 4:12:39 PM8/9/12
to blacktree-...@googlegroups.com
Great, an even better solution!
Reply all
Reply to author
Forward
0 new messages