 |
 |
AppleScript Editor broken in Panther?
|
 |
|
 |
|
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status:
Offline
|
|
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
|
|
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
|
|
I believe "Record" works (only?) in the Finder...
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
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.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status:
Offline
|
|
Thanks for the tip. I'll try it.
|
|
•
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status:
Offline
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status:
Offline
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|