Thursday, December 14, 2017

#1 2009-08-28 06:29:24 pm

Craig Williams
Administrator
From:: Ft. Smith, AR
Registered: 2006-12-07
Posts: 888

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/ … index.html
http://developer.apple.com/mac/library/ … index.html

Offline

 

#2 2009-08-29 03:54:16 am

regulus6633
Member
From:: Taulov, Denmark
Registered: 2006-11-02
Posts: 1695
Website

Re: AppleScript and AppleScript Studio in Snow Leopard

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!

Offline

 

#3 2009-08-29 04:43:37 am

RetroDesign
Member
Registered: 2009-03-11
Posts: 172

Re: AppleScript and AppleScript Studio in Snow Leopard

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 ?

Last edited by RetroDesign (2009-08-29 04:51:44 am)

Offline

 

#4 2009-08-29 05:15:35 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: AppleScript and AppleScript Studio in Snow Leopard

RetroDesign wrote:

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.

Last edited by StefanK (2009-08-29 05:35:59 am)


regards

Stefan

Offline

 

#5 2009-08-29 05:20:04 am

RetroDesign
Member
Registered: 2009-03-11
Posts: 172

Re: AppleScript and AppleScript Studio in Snow Leopard

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 smile

Offline

 

#6 2009-08-29 09:20:22 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: AppleScript and AppleScript Studio in Snow Leopard

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:

[code]defaults write com.apple.InterfaceBuilder3 IBEnableAppleScriptStudioSupport -bool YES[/code]


regards

Stefan

Offline

 

#7 2009-08-29 06:04:01 pm

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 4453

Re: AppleScript and AppleScript Studio in Snow Leopard

Hi.

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


NG

Offline

 

#8 2009-08-29 09:13:10 pm

mark hunte
Member
From:: Hello, London Calling
Registered: 2006-03-20
Posts: 1030
Website

Re: AppleScript and AppleScript Studio in Snow Leopard

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

Last edited by mark hunte (2009-08-29 09:14:06 pm)


Tap,tap,tap , hello , testing 1..2,  1...2,
http://www.markosx.com/thecocoaquest/

Offline

 

#9 2009-08-30 01:08:20 pm

dougtallman
Member
Registered: 2008-05-18
Posts: 17

Re: AppleScript and AppleScript Studio in Snow Leopard

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.

Offline

 

#10 2009-08-31 04:07:50 am

MRoig
Member
Registered: 2008-04-27
Posts: 111

Re: AppleScript and AppleScript Studio in Snow Leopard

dougtallman wrote:

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":

Applescript:

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:

Applescript:

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.


Filed under: Finder

Offline

 

#11 2009-08-31 04:24:44 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: AppleScript and AppleScript Studio in Snow Leopard

MRoig wrote:

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.


Absolutely right smile


regards

Stefan


Filed under: Finder

Offline

 

#12 2009-09-01 07:14:33 am

dougtallman
Member
Registered: 2008-05-18
Posts: 17

Re: AppleScript and AppleScript Studio in Snow Leopard

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.)

Offline

 

#13 2009-09-02 07:18:26 am

MRoig
Member
Registered: 2008-04-27
Posts: 111

Re: AppleScript and AppleScript Studio in Snow Leopard

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

Offline

 

#14 2009-09-03 09:05:28 am

porkozone
Member
From:: Murfreesboro, TN
Registered: 2008-01-30
Posts: 85

Re: AppleScript and AppleScript Studio in Snow Leopard

MRoig wrote:

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":

Applescript:

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:

Applescript:

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.


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

In order to preserve compatibility with existing scripts, AppleScript redirects most of these commands to the current application, that is, the process running the script. If a script sends events to a remote computer via EPPC (“Remote Apple Events”), AppleScript may redirect them to the System Events process on the target machine. AppleScript Editor’s Event Log will show when this redirection happens: you will see the event sent first to the original target process, return an error, and then sent again, often to the current application.


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...


Scott Dye


Filed under: Finder

Offline

 

#15 2009-09-03 09:19:11 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: AppleScript and AppleScript Studio in Snow Leopard

dougtallman wrote:

How strict is this?


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


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)