• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Turn an AppleScript into a .app bundle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turn an AppleScript into a .app bundle?


  • Subject: Re: Turn an AppleScript into a .app bundle?
  • From: Christopher Nebel <email@hidden>
  • Date: Sun, 13 Jul 2003 18:30:36 -0700

On Monday, July 7, 2003, at 2:24 PM, Andrew wrote:

We don't support bundled applets yet, it's planned for a future version. Because an applet is a CFM two-fork style executable, it can't be used in the MacOS folder of a bundle, and if you put it elsewhere in a bundle Mac OS X will assume that you want to run it in Classic, which is probably not what you want.

To build a bundle on the fly with AppleScript, you need a binary executable in the /MacOS folder of the bundle that will load a script and run it. The AppleScript Studio executable does exactly this; your script could just build a bundle that uses the parts from a Studio application (the executable, the nib, the application.applescript script) and adds your custom resources and scripts.

I had the same symptoms however if I moved the applet to the "contents" level, that is, the same level as the MacOS folder would be. My script applet runs fine and it runs in macOS X ('I know 'cause I'm using "do shell script" and it works fine).

So what happened? Did doing this become "supported"? Why does it still not work if the applescript is in the MacOS folder? Why can't I find any better docs on application bundles other than this <http://developer.apple.com/documentation/MacOSX/Conceptual/ SystemOverview/Bundles/chapter_5_section_1.html>?

Lots of different questions. First, the original quote from me is outdated -- applets stopped being CFM in Mac OS X 10.1. (We did this so we could have a single applet format that would work everywhere, instead of the old classic applet/Mac OS X applet split.) These days, it's a two-fork file with a Mach-O executable in the data fork and 68K code in the resource fork.

This happens to more or less work if you put it inside a bundle, so there's the answer to your first/second question. To produce a more standard bundle, you'll need to tear the two forks apart -- the data fork (the actual executable) goes in Contents/MacOS, while the resource fork goes into a resource file in Contents/Resources. (It's more complicated than that -- there are other resources that go into different places in the bundle -- but those are the basics.)

As for why it doesn't work if you drop a script in Contents/MacOS, well, that's simple: a script is not an executable. It's got to be something that the kernel knows how to run, i.e., a Mach-O or CFM executable, and a script isn't either of those.

As for documentation, you might look under CFBundle or NSBundle.


--Chris Nebel
Apple Development Tools
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Turn an AppleScript into a .app bundle? - Follow up to list archives (From: Andrew <email@hidden>)

  • Prev by Date: Re: OSA Errors -1750 and -1753
  • Next by Date: Re: Running VPN client...
  • Previous by thread: Re: Turn an AppleScript into a .app bundle? - Follow up to list archives
  • Next by thread: copy Mac HD to remote share
  • Index(es):
    • Date
    • Thread