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 > Simple AppleScript Help Please

Simple AppleScript Help Please
Thread Tools
RevEvs
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status: Offline
Reply With Quote
Jun 22, 2004, 07:10 PM
 
Ok, been trying to do some GUI scripting of a Java app (dMSN), but failing.

Using UI Browser from prefab i can activate what i need from within that app, but cant seem to transfer that into an applescript.

UI Browser gives me

Code:
application "dMSN" window "dMSN Messenger" (1) menu bar 1 menu "MSN" (1) menu "Change status" (1) menu item "Online" (1)
and

Code:
pick menu item "Online" of menu "Change status" of menu "MSN" of menu bar 1 of window "dMSN Messenger"
although when i try and put this into an applescript i jsut get errors. Any help appreciated


revs
I free'd my mind... now it won't come back.
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Jun 22, 2004, 10:20 PM
 
You need to look at the example UI scripts that are installed in /Library/Scripts. You first activate the application you want to try to script, then tell System events, fianlly tell the process you activated.

The sample scripts cover several different GUI situations and are easy to follow. If you are new to Applescript, I would not start with UI scripting, though. FWIW.

Craig
( Last edited by suthercd; Jun 22, 2004 at 10:30 PM. )
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jun 23, 2004, 05:31 AM
 
Something link this:
[php]
tell application "System Events"
tell process "dMSN"
tell window "dMSN Messenger"
tell menu bar 1
tell menu "MSN"
tell menu "Change status"
select menu item "Online"
end tell
end tell
end tell
end tell
end tell
end tell
[/php]
     
RevEvs  (op)
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status: Offline
Reply With Quote
Jun 23, 2004, 07:20 AM
 
I've been through the example scrips and such, and tried many things. And just ger the error:

"System Events got an error: NSReceiverEvaluationScriptError: 4"
I free'd my mind... now it won't come back.
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jun 23, 2004, 10:49 AM
 
I just downloaded dMSN and gave it a go - It didn't work at all here either - perhaps UI scripting doesn't work too well with Java..
     
RevEvs  (op)
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status: Offline
Reply With Quote
Jun 23, 2004, 12:16 PM
 
thats what i thought. Although PreFab I Browser does seem to be able to perform the actions, just doesnt work when put in an apple script.. ah well nevermind, may just ask the developer to add basic applescript support.

cheers
I free'd my mind... now it won't come back.
     
   
 
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 10:20 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.,