0

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

UI Browser result on hover

9
  • -9223372036854775808 looks like a bug somewhere, it's 0x0x8000000000000000. "menu -9223372036854775808" is a string. Try click menu item 4 of menu 1. Commented Mar 4 at 17:25
  • Thank you - it seems to hang with no click executed, Script Editor result: "missing value" 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? Commented Mar 5 at 4:02
  • Try delay 0.5 to wait for the menu. 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? Commented Mar 5 at 4:40

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.