Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Window contents traversing

Window contents traversing
Thread Tools
ktolis
Junior Member
Join Date: May 2000
Location: Thessaloniki,Makedonia,Greece
Status: Offline
Reply With Quote
Apr 18, 2007, 05:13 AM
 
I am looking for a script/code/script language/excerpt/anything that would allow me to read the contents of application windows. I want to read some strings/values from an application I don't have the source code. The application is using Cocoa windows and I need to read only generic data (strings or object positions at most).

Has anyone got some pointers I could follow. The ideal solution I guess would be the ability with some sort of script to be able to traverse a hierarchy in the form of

system.application[1].window[2].title
system.application[1].window[2].string[5].text
system.myappname.window[0].textbox[1].height

or so. I'd appreciate if you point me to some code or example.

thnx!
     
Mithras
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Apr 18, 2007, 11:31 AM
 
Two options:
If the app has an Applescript API, you can use that directly. Find out by opening Script Editor, and then drag-and-dropping the application onto Script Editor's icon in the Dock.

If not, Applescript GUI scripting may be able to do what you want.
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Apr 18, 2007, 11:52 AM
 
AppleScript is the intended way to do this.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
ktolis  (op)
Junior Member
Join Date: May 2000
Location: Thessaloniki,Makedonia,Greece
Status: Offline
Reply With Quote
Apr 18, 2007, 06:43 PM
 
I agree with using AppleScript but not all applications use it ( sigh ) and the one I need to access doesn't either.

Mithras you mentioned AS GUI Scripting. Any links to some useful tutorials/guides?
     
ktolis  (op)
Junior Member
Join Date: May 2000
Location: Thessaloniki,Makedonia,Greece
Status: Offline
Reply With Quote
Apr 18, 2007, 07:00 PM
 
I found

http://www.apple.com/applescript/uiscripting/index.html

I tried PrefabUI too but neither this nor Apple's utility provide nested UI items. I guess this is as good as it gets for now.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:37 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,