Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to parse the output of Applescript which is in object format to text??

currently am running to retrieve entire contents of window from Applescript in Java, applescript is returning class objects which is not happening if i run the same script from java, pls suggest how to format the same.


tell application "System Events"
    
    tell process "Install Adobe Flash Player"
        
      set tElements to entire contents of window 1
            
        end tell
end tell
tElements


output :


{button 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button 2 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button 3 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", image 1 of group 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Adobe Flash Player 11" of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", progress indicator 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 3 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "  " of group 3 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", image 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 4 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Error: General installation error" of group 4 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Adobe Flash Player Installer" of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events"}

Mac OS X (10.7.4)

Posted on Oct 25, 2012 11:25 PM

Reply
3 replies

Oct 28, 2012 10:13 PM in response to madhusudhanjr

I'm really not sure what you're looking for, but I'll hazard a guess that java is converting the objects to their text description. in that case you'd want something like this:


tell application "System Events"


tell process "

Install Adobe Flash Player
"


set tElements to (entire contents of window 1)

repeat with thisElement in tElements

set contents of thisElement to description of thisElement

end repeat

end tell

end tell

tElements

How to parse the output of Applescript which is in object format to text??

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.