Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Reduce launch times for AppleScript apps on Intel System 10.4
If you use AppleScripts that you save as applications and are on an Intel Mac, you should like this hint.

In Script Editor, if you save as Application, this will create a PowerPC-only application -- it will launch on an Intel mac, but under Rosetta. However, if you save it as an Application Bundle instead, this will create a Universal binary. The Application Bundle behaves the same in the GUI as an Application -- it is a double-clickable application.

Note that the actual script itself is not compiled in either case, it is interpreted at run-time. What is changed is the wrapper around the script. This means that saving as an Application Bundle on an Intel Mac will not improve the execution time of the actual script, but you should notice a significant improvement in launch time, as Rosetta does not have to be invoked. If you saved any scripts as Applications on a PowerPC Mac and have since upgraded to an Intel Mac, you can always open them in Script Editor and re-save them as Application Bundles.
    •    
  • Currently 2.83 / 5
  You rated: 1 / 5 (6 votes cast)
 
[14,157 views]  

10.4: Reduce launch times for AppleScript apps on Intel | 8 comments | Create New Account
Click here to return to the '10.4: Reduce launch times for AppleScript apps on Intel' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Reduce launch times for AppleScript apps on Intel
Authored by: DougAdams on Aug 04, '06 08:00:14AM
Not having an Intel Mac -- yet -- I'd be curious to know if bundled AppleScript apps appear in, for instance, iTunes' Script Menu, or the Script Menu, which they do not on PPC Macs. I'm doubting it.

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]

10.4: Reduce launch times for AppleScript apps on Intel
Authored by: Dieringer on Aug 04, '06 08:51:15AM

Is there any quick way to find all my compiled scripts?



[ Reply to This | # ]
10.4: Reduce launch times for AppleScript apps on Intel
Authored by: Mr. H on Aug 04, '06 10:32:12AM

Hi Doug,

Just tried it with iTunes and your excellent "copy tag info" script, and it seems that iTunes picks up the actual script file from inside the bundle (the script is called main). You can select it and the script will run, but not as a separate application, which means that once you get to the point where you need to select tracks, you can't (the script takes over control of the GUI).

It sure would be nice if Apple sorted this out. I'll file a bug report with Apple and see what happens.



[ Reply to This | # ]
10.4: Reduce launch times for AppleScript apps on Intel
Authored by: DougAdams on Aug 04, '06 11:33:15AM
Harry:

Drat! That was an excellent script to test with, too, btw, since it does require some back and forth focus. Interesting behavior.

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]

10.4: Reduce launch times for AppleScript apps on Intel
Authored by: wordtech on Aug 07, '06 07:31:01AM

This is just plain goofy--anyone know why Apple has made AS application bundles universal but not applets? There are sometimes valid reasons to prefer an applet over an application bundle, particularly if you are executing a command as an administrator. When you execute "do shell script foo with administrator privileges" under an applet (standalone script), you are presented with a dialog that includeds the correct name of your applet ("mycoolscript.app requires you to enter your password"). With an application bundle, the actual executable (in mycoolscript.app/Contents/MacOS) is called "applet," and you get this dialog: "applet requires you to enter your password." Not very polished.

I realize one can use AppleScript Studio to work around this, but ASS is usually overkill for my needs.



[ Reply to This | # ]
fixing the application name for compiled AppleScripts
Authored by: hayne on Jan 05, '07 10:54:36AM
You can fix this problem (that all AppleScript apps compiled into an application bundle have "applet" as the executable name) by using my Bash script 'fixAppleScriptApp' (available from: my Bash scripts page)
This script modifies the application bundle so that the executable is named the same as the .app
It also provides the option to change the "creator code" or "signature" of the compiled AppleScript application.

[ Reply to This | # ]
Why Non-Bundles aren't Universal
Authored by: jediknil on Aug 08, '06 11:25:30AM

AFAIK, AppleScript Applications (not bundles) are a relic of OS 9, still containing a resource fork and running as Carbon (you may notice the "Open in the Classic Environment" box if your computer still supports it). Apple is probably trying to discourage their use, as they seem to be doing with most of the Classic-style single-file applications. Two identical scripts saved saved as Application and Application Bundle end up with almost the same file size anyway.

According to the AppleScript release notes, the application bundle style only works on 10.3 and later systems, but also allows you to add custom Scripting Additions that are only loaded for your application.

As far as the "administrator privileges" problem goes, submit a bug report.



[ Reply to This | # ]
10.4: Reduce launch times for AppleScript apps on Intel
Authored by: jerrykrinock on Jun 24, '08 08:23:33PM

There's an even more important reason to heed this hint. If you email a regular AppleScript "application" document to someone, without zipping it, it will arrive as a Classic application, which most people (who have not installed Classic) won't be able to run. But if you save as an Application Bundle as recommended here, it will work.

Why didn't Apple make "Application Bundle" the default? Or at least give a big warning when using "Application". Oh, well.

Thanks for the hint!

Jerry



[ Reply to This | # ]