Re: Opening AppleScript *.app files for editing
Re: Opening AppleScript *.app files for editing
- Subject: Re: Opening AppleScript *.app files for editing
- From: Scott Babcock <email@hidden>
- Date: Tue, 26 May 2009 15:02:15 -0700
- Acceptlanguage: en-US
- Thread-topic: Opening AppleScript *.app files for editing
Regarding 'osacompile' and forked files, I learned something that makes some amount of sense but was a bit surprising. I had been saving my compiled scripts manually from Script Editor and then switched to using 'osacompile'. On my initial pass, I simply overwrote the existing files with the new output. Some of the existing files had been saved to the resource fork, and my 'osacompile' command specified saving to the data fork. The result was that I ended up with two different version of the same compiled code - an old one in the resource fork and a new one in the data fork.
It appears that AppleScript 2.x prefers to load from the data fork, whereas AppleScript 1.9.x prefers to load from the resource fork.
Also, doesn't the current version of 'cp' copy resource forks? I thought that it did, but I don't know where I got this idea...
-----Original Message-----
Date: Mon, 25 May 2009 21:19:36 -0700
From: Christopher Nebel <email@hidden>
Subject: Re: Opening AppleScript *.app files for editing
To: Applescript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
On May 24, 2009, at 8:04 PM, Doug McNutt wrote:
> At 18:09 -0600 5/24/09, I wrote a question about opening a .app for
> editing..
>
> It turns out that I didn't copy the resource fork to the new
> directory. CpMac repaired most of the damage.
>
> After opening up the /Users/jim/bin/ directory I was able to edit
> and save the APPL but I couldn't just save. I had to do a save-as
> and redeclare it to be an APPL. Script Editor doesn't mind just
> saving in my space. It's only on Jim's space, while logged in as me
> with admin privileges, that I have to do the save-as thing.
>
> But now I'm worried about using my AppleScript on Tiger or Leopard.
> I was a bit surprised to find the binary in the resource fork the
> way things were on 68k boxes. Is that still the case in more modern
> versions of OS neXt? What about Intel machines?
What you're seeing is the distinction between saving as an
"application", which is a PowerPC-only single-file application, versus
an "application bundle", which is a PowerPC/Intel file package. Both
of them work fine on Leopard, Tiger, and even Panther (10.3) systems,
though application packages won't work on anything older than that.
The single-file format has the bits it needs to run all the way back
to System 7.1, though whether or not your script works is a separate
question.
As a practical matter, copying single-file applications requires
copying the resource fork (as you've already discovered), so use
Finder, CpMac, or ditto(1). (You'll need to manually specify "ditto --
rsrc" if you're on 10.3 or earlier.) Copying bundled applications can
be done using cp -R, since all the files in the package use only the
data fork.
As for script files (as opposed to applications), data-fork scripts
have been the default for a while, at least from Script Editor.
osacompile(1) still outputs the old-fashioned resource-fork scripts by
default; use "-d" to get a data-fork one.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden