Jump to content

Anyone Know how to Run an OSX service in a workflow?

Recommended Posts

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
Link to comment
  • 9 months later...

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 by deanishe
Link to comment
  • 5 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...