alfredclough Posted December 4, 2013 Posted December 4, 2013 I'm thinking specifically of maybe an applescript command that would let you pass input to a text based service and get the output from it.
forgetfulfellow Posted December 5, 2013 Posted December 5, 2013 Hopefully this looks promising for you If it does, tell me! I might want to use it too http://my.safaribooksonline.com/book/programming/applescript/0596008503/manipulating-text/applescripttmm-chp-4-sect-2
alfredclough Posted December 5, 2013 Author Posted December 5, 2013 That's a great summary of using dialog boxes in Applescript, but I don't see any reference to calling OS X services through Applescript.
deanishe Posted December 6, 2013 Posted December 6, 2013 This should do the trick. Kinda. It assumes that the main menu (where the Services menu resides) has the same name as the application. This isn't true for Google Chrome, for example, so the script doesn't work with it. set theServiceName to "OmniFocus: New Inbox Task per Line" tell application "System Events" set appName to item 1 of (get name of processes whose frontmost is true) tell (process 1 where frontmost is true) tell menu bar 1 tell menu bar item appName tell menu appName tell menu item "Services" tell menu "Services" click menu item theServiceName end tell end tell end tell end tell end tell end tell end tell
alfredclough Posted December 6, 2013 Author Posted December 6, 2013 deanishe, That's a creative idea, but I was looking for a programmatic way to access the service. Kinda the way in Quicksilver you could enter text and then pass it into any OS X service.
deanishe Posted December 7, 2013 Posted December 7, 2013 Err, that is a programmatic way … You mean an actual API? There isn't one, not for AppleScript. Quicksilver can do it because it's a Cocoa application. AppleScript can't. You need to call the Cocoa NSPerformService class, which could possibly be done via AppleScript using Automator Runner, thus.
deanishe Posted October 1, 2014 Posted October 1, 2014 (edited) Glad it works for you, but that sounds like an OS bug. Still, Spotlight on German systems recognises the English names of apps, so maybe the bug is that it doesn't work without ever changing the system to English and not that it works in the "wrong" language. Edited October 1, 2014 by deanishe
tempelorg Posted April 29, 2020 Posted April 29, 2020 In 2015 I made an Automator action "Run Service" that lets you invoke Services that work on text or files. See https://blog.tempel.org/2015/09/RunServiceForAutomator.html and https://github.com/tempelmann/RunServiceActionForAutomator
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now