AppleScript and AppleScript Studio in Snow Leopard

Check out the AppleScript and AppleScriptObjC Release Notes
Big changes in Snow Leopard for AppleScript. No more AppleScript Studio but we get total access to Objective-C frameworks!

http://developer.apple.com/mac/library/releasenotes/ScriptingAutomation/RN-AppleScriptSL/index.html
http://developer.apple.com/mac/library/releasenotes/ScriptingAutomation/RN-AppleScriptObjC/index.html

Wow!

Not much change in the applescript language but applescript studio is gone as we know it! I can’t imagine what it’s going to take for a new user to write an application in xcode using applescript now. They’re going to have to learn to read the obj-c doc’s, figure out what “delegate methods” are… holy cow! That’s such a huge undertaking for new developers of applescript applications.

I guess this website is going to have to change too. The whole applescript studio section is going to have to be replaced and the moderators are going to have to be fluent in obj-c now.

I’m totally shocked!

I spend the last 2 weeks writing in AppleScript Studio. A few hours a day. And now ? Apple cancelled it ? It’s going to be a MAJOR change ! Is all the time coding just wasted ? I really worked a lot on the app…

And what about PowerPC users ? They’re stuck at 10.5. How are they supposed to write AppleScriptObjC ?

That’s the curse of progress.

Apple gets rid of old habits after a certain amount of time as a matter of principle.

Someone just verified me that AppleScript Studio apps keep working though. You just can’t write them in Snow Leopard. Well that’s better than nothing :slight_smile:

from the AppleScriptObjC Release Notes

AppleScriptObjC obsoletes AppleScript Studio, which is deprecated as of Mac OS X v10.6. Developers using AppleScript Studio should migrate to AppleScriptObjC, and should start new projects using AppleScriptObjC exclusively. AppleScript Studio development is still supported, but functions for creating new projects have been removed, and the AppleScript Studio palette in Interface Builder has been hidden. To re-enable it, use this command in Terminal, and then re-launch Interface Builder:

defaults write com.apple.InterfaceBuilder3 IBEnableAppleScriptStudioSupport -bool YES

Hi.

From the similar discussion on the AppleScript-Users list, it appears there are some later Snow Leopard AS release notes here.

I do not have 10.6 yet,
But I wondered what with the changes to the Finder, if the way to perform actions on its selected items have improved or should I say gone back to the old way in Mac Os9.

With the Mac Os9 way you did not need to iterate with a repeat loop on each item of the selection.
This is one thing that has always been a bugbear of mine in Mac Os X.

Has anyone tested it?

Thanks

Has anyone seen a remarkable change in performance with existing scripts? I’ve heard second hand that a buddy’s script, which has a hefty tell block for the Finder, is a good deal slower under SL than Leopard.

I’m a bit nervous about that myself. I think the explanation can be found here, scroll down to “Scripting Addition Security”.

Turns out that this is regarded as a “double send”:

tell application "Finder"
    set folderName to date string of (current date)
    make new folder with properties {name:folderName}
end tell

…and therefore is much less efficient than:

set folderName to date string of (current date)
tell application "Finder"
    make new folder with properties {name:folderName}
end tell

In other words, you have to try and keep as much outside a "tell application “finder” "-block as is possible. I assume this is true for every “tell application” block, not just for the finder. The more experienced programmers on this forum will tell you this has always been the case. It’s just that sloppy amateurs like myself have been getting away with bloated “tell application” blocks for a while. Looks like it may well have come back to bite us with this new scripting addition security.

Absolutely right :slight_smile:

How strict is this?

Suppose you have a script that fetches a file name, manipulates the name string then renames the file.

Should the string manipulation be outside the tell block, or are there some commands/operators that can reasonably be inside without a performance hit?

What about repeat loops? For example, you want to rename all or some files inside a folder? Is it better to have the loop inside the tell block or the tell block inside the repeat loop? (I vaguely remember reading/hearing that there’s a performance hit each time AS creates a tell block. It could be a “virtual” memory, or a bad habit I tried to rationalize.)

After an evening of banging my head against the wall, I came here to ask if someone was working on a tutorial to get some of us started, only to find out Craig already made a nice little tutorial in the “unScripted” section of this forum. :cool:

Count me in as another sloppy amateur that is nervous about this. I have a rather large script, that I’ve built as I’ve learned. I know there are large tell Finder blocks in it, mainly because of my stumbling blocks early of knowing what had to be done by the finder and what did not. My company is not updating to SL for a whle, but i would like to start removing this sloppy code where I can. However, I’m still not sure I would know (without tons of trial and error, mostly error) what can be removed without a resulting error.

So I read that

I assume this means I would be able to run my script, and looking through the Event Log and see what parts can be extracted safely from the tell block, because they are reported as “double sends”. I assume this can only be done from within Snow Leopard’s new Applescript editor correct? Is there any way of determining this in a similar manner using Leopard? I’m not sure if I will be able to update my development machine to SL either for awhile, but would like to start moving away from my sloppiness before it bites me in the butt…

if you avoid scripting additions in application tell blocks and nested application tell blocks the scripts are safe.
The crucial point are mistakable keywords in application tell blocks
All pure AppleScript dictionary terminology is not affected