select - Applescript - targeting a menu with numeric ID - Stack Overflow

I'm a noob at Applescript, but managed to get the first half of this script to just display the me

I'm a noob at Applescript, but managed to get the first half of this script to just display the menu. The image is a mouse hover to display the UI Browser result. The syntax for clicking on a menu with a long number instead of a name eluded all my searching. Perhaps a Relative Specifier could work for that specific menu item?

tell application "System Events"
tell process "Remote Desktop Scanner"
    tell menu bar 2
        click menu bar item 1
        click menu item 2 of "menu -9223372036854775808" (this bit failed)
    end tell
end tell
end tell

I'm a noob at Applescript, but managed to get the first half of this script to just display the menu. The image is a mouse hover to display the UI Browser result. The syntax for clicking on a menu with a long number instead of a name eluded all my searching. Perhaps a Relative Specifier could work for that specific menu item?

tell application "System Events"
tell process "Remote Desktop Scanner"
    tell menu bar 2
        click menu bar item 1
        click menu item 2 of "menu -9223372036854775808" (this bit failed)
    end tell
end tell
end tell

Share edited Mar 4 at 7:44 bobzIlla asked Mar 4 at 7:24 bobzIllabobzIlla 1711 silver badge6 bronze badges 9
  • -9223372036854775808 looks like a bug somewhere, it's 0x0x8000000000000000. "menu -9223372036854775808" is a string. Try click menu item 4 of menu 1. – Willeke Commented Mar 4 at 17:25
  • Thank you - it seems to hang with no click executed, Script Editor result: "missing value" – bobzIlla Commented Mar 4 at 18:31
  • 1 What happens if you run a get menus of menu bar 2? And menus of menu bar 1 for that matter? – Mockman Commented Mar 5 at 4:02
  • Try delay 0.5 to wait for the menu. – Willeke Commented Mar 5 at 4:16
  • Thanks so much, tried all 3 of these suggestions (and Mockman's one at a time), same basic result: "System Events got an error: Can’t get menu bar 1 of menu bar 2 of process \"Remote Desktop Scanner\". Invalid index." number -1719 from menu bar 1 of menu bar 2 of process "Remote Desktop Scanner" Feels like it may not be do-able the way the app was written? – bobzIlla Commented Mar 5 at 4:40
 |  Show 4 more comments

1 Answer 1

Reset to default 0

Turns out that Remote Desktop Scanner app was piggybacking on the native macOS Screen Sharing app. I guess it's useful for 'bookmarking' several server addresses, and providing the toolbar icon. I mistakenly thought I needed a third party solution to VNC to a PC running RealVNC.

Once I got over feelings of derp, I was able to achieve the proper sequence to get the desired behavior. Not sure why it took a doubling up of keystroke return and key code 36 to execute a working return key press for a pupup window, but this worked for me. Came away learning more about Applescript, thanks so much for the help.

tell application "/System/Library/CoreServices/Applications/Screen Sharing.app" to activate 
tell application "System Events"keystroke "192.168.1.130"
keystroke return
key code 36
end tell

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745057546a4608760.html

相关推荐

  • select - Applescript - targeting a menu with numeric ID - Stack Overflow

    I'm a noob at Applescript, but managed to get the first half of this script to just display the me

    20小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信