jithendra k.s jithendra k.s - 3 months ago 11
AppleScript Question

using of UI element in my script is giving "Expected class name but found identifier." Syntax error

I am very new to apple script, I am trying to get all the UIElements, here is my code

tell application "Myapp"
set visible to true
return every UI element of front window
return name of every UI element of front window
end tell


I got this code from here
can anyone please help me to get out of this
Note : My OS is OS X EI Capitan 10.11.1

Answer

You have to ask the process of the app – which System Events knows – for that information.

tell application "System Events"
  tell process "Myapp"
     set visible to true
     return every UI element of front window
     -- return name of every UI element of front window
  end tell 
end tell 

The name of the process can be different from the name of the application

Comments