|
|
#1 |
|
Prospect
Join Date: Jan 2013
Posts: 5
|
Shortcut to services menu
I'm trying to write a script that will open the <appname>/Services menu and then wait for the user to select an application service. I have an app that clicks on the right Services menu item (I tested it with other items--those are the comments), but then the actual Services menu does not display. How do I get the Services submenu to display?
Here is my script so far, maximally verbose for clarity. tell application "System Events" set app_name to the name of the current application tell application process app_name tell menu bar 1 tell menu bar item app_name tell menu app_name click menu item "Services" #click menu item ("About " & app_name) #tell menu item "Services" # tell menu "Services" # click menu item "Services Preferences…" # end tell #end tell end tell end tell end tell end tell end tell |
|
|
|
|
|
#2 |
|
Prospect
Join Date: Jan 2013
Posts: 5
|
I forgot to say: I'm running Mountain Lion, osx 10.8.2.
|
|
|
|
|
|
#3 |
|
Prospect
Join Date: Jan 2013
Posts: 5
|
Anyone there? Why does the "click menu item \"Services\"" not open the menu with the available Services options?
|
|
|
|
|
|
#4 |
|
League Commissioner
Join Date: Jan 2002
Posts: 7,944
|
Since Lion, the Services menu is contextual. So, often no services are applicable.
Could that be the reason that your script won't show the services menu (because no services apply)? |
|
|
|
|
|
#5 | |||||||||||||||||||||||
|
League Commissioner
Join Date: Aug 2006
Posts: 5,039
|
Since Snow Leopard, surely? Can I ask what the end goal of this is? You can assign keyboard shortcuts directly to Services in System Prefs > Keyboard. Most of the time, the relevant services should be available on a right-click (or double-tap etc). Have you made sure that "Enable access for assistive devices" in turned on in System Prefs > Accessiblity. I think that has to be on for these "follow-my-click" OSAX commands to work. Have you seen these pages? They might help: http://hints.macworld.com/article.ph...60921045743404 http://www.macosxautomation.com/appl...ing/index.html |
|||||||||||||||||||||||
|
|
|
|
|
#6 |
|
Prospect
Join Date: Jan 2013
Posts: 5
|
There are definitely Services available.
The objective is to get a list of the available services that I can choose from. Shortcuts are problematic if you have too many...and if your memory is as bad as mine. And, yes I had "Enable for assistive devices" clicked. |
|
|
|
|
|
#7 |
|
League Commissioner
Join Date: Jan 2002
Posts: 7,944
|
But, you already have "a list of the available services that I can choose from" in your _Services_ menu?
I am (slightly) curious about how some kind of script would be better for you than the services menu itself? |
|
|
|
|
|
#8 |
|
Prospect
Join Date: Jan 2013
Posts: 5
|
To get to that list, I need to grab the mouse, move the cursor, click on the app menu item, move the mouse down to services...I want to have a keyboard shortcut tied to the script so that I do that one keystroke and get to the same place as above.
I could pull up the contextual menu, which would be a little faster. But I like to keep my hands on the keyboard as much as possible. I use services a LOT, so a shortcut would be very nice. |
|
|
|
|
|
#9 |
|
Hall of Famer
Join Date: Dec 2007
Posts: 3,641
|
Scripting the GUI is always a pain. Maybe it would be better to use Services Manager to assign keyboard shortcuts to the Services you often use. I've used it under 10.7, not 10.8, but there's no reason to think it won't work in Mountain Lion.
As always with custom keyboard shortcuts, avoid using shortcuts already used globally (like Command-C for Copy) or within specific applications (like Command-D in Safari for bookmarking the current page). http://macosxautomation.com/services/servicesmanager |
|
|
|
![]() |
| Tags |
| services |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|