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 > Applications > AppleScript Editor broken in Panther?

AppleScript Editor broken in Panther?
Thread Tools
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Sep 23, 2004, 01:48 AM
 
It's been quite a long time since I've used AppleScript, but recently I encountered a nasty little bug and I decided I needed to write a little script that would automatically set a desktop background picture. I started AppleScript Editor and tried to use the 'Record' function to get an idea of how I could write the script.

No matter what I tried to do the 'Record' function didn't write one line of script. It didn't even record anything when I did manually what one of the example scripts does. And it didn't even record anything when I worked with applications that claim to be scriptable (like the Finder).

Now in the old days of Mac OS 8 and 9 I remember using this 'Record' button with some success. So, what's the deal with OS X? Or is it just in Panther? Is this function broken? Does it ever do anything?
     
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Sep 23, 2004, 06:26 AM
 
I can't tell you why - but no, I don't think the "record" feature is working yet in X (in any version). If you need example code though, there are a number of places you can post and ask (including these forums, but also sites dedicated to applescript)
cpac
     
Mac Elite
Join Date: Jun 2003
Location: Newport News, VA USA
Status: Offline
Reply With Quote
Sep 23, 2004, 07:31 AM
 
I believe "Record" works (only?) in the Finder...
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Sep 23, 2004, 10:25 AM
 
You can trigger GUI actions in Applescript in Panther by scripting System Events. For instance:[php]activate application "System Preferences"
tell application "System Events"
tell process "System Preferences"
--GUI scripting
click menu item "Desktop & Screen Saver" of menu "View" of menu bar item "View" of menu bar 1
end tell
end tell[/php]
Apple has an application UIElementInspector that is available in the Applescript section of its website. PreFab Software has developed UI Browser which is a great tool for writing UI scripts. There are example UI scripts in /Library/Scripts/UI Element Scripts included with Panther.

HTH
Craig
(Last edited by suthercd; Sep 24, 2004 at 08:55 AM. )
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Sep 23, 2004, 01:33 PM
 
Thanks for the tip. I'll try it.
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Sep 28, 2004, 05:00 AM
 
In the mean time I have actually discovered that you don't need to even open up the System Preferences in such an AppleScript.

This little script did the trick for me. Now it's a little stand-alone application sitting in my dock and when my desktop background image disappears I just launch the app and it's fixed. :)

Code:
tell application "Finder" set desktop picture to "Library:Desktop Pictures:Aqua Blue.jpg" end tell
So simple, it's almost embarrassing. ;)
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 28, 2004, 11:03 AM
 
Record in general was a very badly thought out thing that was a total PITA to implement into an application - any "recordable" action had to be implemented by sending an AppleEvent to yourself, which is just stupid. I believe it's also not recommended or supported by Apple any more, but even in OS 9 and earlier very few things were recordable.
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Sep 28, 2004, 01:14 PM
 
Originally posted by Angus_D:
Record in general was a very badly thought out thing that was a total PITA to implement into an application - any "recordable" action had to be implemented by sending an AppleEvent to yourself, which is just stupid. I believe it's also not recommended or supported by Apple any more, but even in OS 9 and earlier very few things were recordable.
I can absolutely understand your point, but, if this is really Apple's POV, why do they still offer the 'Record' button? Why is the button there when it is supported almost nowhere and they even think it shouldn't be supported at all?
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 28, 2004, 04:04 PM
 
Originally posted by Simon:
I can absolutely understand your point, but, if this is really Apple's POV, why do they still offer the 'Record' button? Why is the button there when it is supported almost nowhere and they even think it shouldn't be supported at all?
Yeah, I've always wondered about that.
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2