douglance Posted October 27, 2015 Share Posted October 27, 2015 I am trying to get the time tracking service Hubstaff (http://www.hubstaff.com) to "Start Working" when I type in hubstaff. Here's my script: on alfred_script(q) tell application "Hubstaff" to activate tell application "System Events" tell process "Hubstaff" click menu item "Start Working" end tell end tell end tell end alfred_script I think the issue is that I'm not finding the proper menu. When I select Hubstaff, it doesn't activate it's own items on the menu bar. Rather, you access Hubstaff using it's icon in the menubar. How do I reach that menu with AppleScript? Thanks for your help! Link to comment
RodgerWW Posted October 28, 2015 Share Posted October 28, 2015 You have no menu number: IE click menu item "Start Working" of menu 1 Now, I don't know about hubstaff, but check out this post on Stack Overflow, as it may shed some light on targeting the menu extra item: http://stackoverflow.com/questions/16492839/applescript-on-clicking-menu-bar-item-via-gui-script Link to comment
Obed Posted August 23, 2020 Share Posted August 23, 2020 Did anyone get this working? I'm looking for the same. Link to comment
Dattwood Posted August 25, 2020 Share Posted August 25, 2020 (edited) on clickDockMenu(theMenuItem) tell application "System Events" tell process "Dock" tell UI element "Hubstaff" of list 1 perform action "AXShowMenu" tell menu "Hubstaff" tell menu item theMenuItem perform action "AXPress" end tell end tell end tell end tell end tell end clickDockMenu clickDockMenu("Start Working") This clicks "Start Working" in Hubstaff's menu from the Dock. Under the right circumstances, it should give you what you want. @Obed Edited August 25, 2020 by Dattwood Link to comment
Dattwood Posted August 25, 2020 Share Posted August 25, 2020 (edited) List of valid parameters when calling clickDockMenu: ["Hubstaff", "Start Working", "Add Note", "Hide Timer", "Projects", "Sign Out", "Open Dashboard", "Add/Edit Time", "Report an Error", "Help Center", "About Hubstaff", "Preferences…", "Check for Updates...", "Options", "Show All Windows", "Hide", "Hide Others", "Quit "Force Quit"] Example calls: clickDockMenu("Preferences…") clickDockMenu("Start Working") clickDockMenu("Add Note") Notes: This list can be seen by right-clicking Hubstaff's icon in the Dock. Hubstaff should be running before the call is made. Edited August 25, 2020 by Dattwood Link to comment
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