AFP548

AppleScript – Click Button of Window not working

I'm trying to automate the set up of VirtualBox on a large deployment of MacBooks. One of the tasks is to add an existing hard drive image to a new virtual machine. I could not see any key combination to access that button so I figured I'd just use the click button command. Code reads: tell application "System Events" ... [lots of unrelated code here] tell process "VirtualBox" click button "Existing..." of window "Create New Virtual Machine" delay 1 click button "Add" of window "Create New Virtual Machine" end tell end tell I used the Accessibility Inspector to check the aspects of the button and it says: Application: "VirtualBox" Window: "Create New Virtual Machine" Button: "Existing..." AppleScript error is: System Events got an error: Can't get button "Existing..." of window "Create New Virtual Machine" of process "VirtualBox". Any ideas?
Exit mobile version