Re: Saving an AppleScript that targets my own application
Re: Saving an AppleScript that targets my own application
- Subject: Re: Saving an AppleScript that targets my own application
- From: Derrick Bass <email@hidden>
- Date: Wed, 11 Jan 2006 21:44:37 -0600
On Jan 8, 2006, at 9:33 AM, Daniel Jalkut wrote:
Hi Derrick - we need to get to the bottom of this problem in your
particular case. Suffice to say that this is not a problem across
the board.
Sorry for the delay; I was having a off-list discussion with Nathan
Day (author of NDAppleScriptObject). We managed to make some
progress, but ultimately he could not reproduce my problem. I've been
able to reproduce it on two accounts on my computer (running 10.4.2)
as well as another computer running 10.3.9; I also got misbehavior of
a different sort on another 10.3.9 box.
I managed to create a very simple test app that demonstrates the
problem (at least for me):
<http://www.tapir.caltech.edu/~derrick/ASsave.zip>
I use NDApplecript in FastScripts, where I run all manner of
scripts including scripts that are targeting FastScripts itself.
That being said, I don't *compile* the scripts in FastScripts - is
that what you're doing with your example script? As a quick test,
what happens if you paste and save the script from Script Editor,
and then load it as a compiled script from disk in your application?
My app doesn't load or run AppleScripts; what's happening is that
when users find a combination of options useful, they can select
"save as script". That is supposed to save a compiled AppleScript
that will call the program with the same set of options. As per
Nathan's suggestion, I added a creator code to my app and used the
NDComponentInstance function setDefaultTargetAsCreator. This helps:
the script is correctly interpreted if the application is left
running. But it still won't work if the program is quit.
In the sample app above, the script is just
tell application "ASsave"
do it
end tell
What I want to do is save this script in such a way that *another*
program can load and run it (iTunes, to be specific).
Anyway, if you run the sample app I linked to, clicking the "Save
Script" button compiles and saves this script on the Desktop.
Now if I leave ASsave open and open the script in Script Editor, it
looks fine and it runs fine. Now I close the script and then quit
ASsave. Now opening the script again, I'm presented with a dialog
asking me "Where is ?". I'm assuming that somehow the name of ASsave
is not getting stored in the script. (On a second 10.3.9 box, Script
Editor simply froze; I left it for a few hours, but it never came
back; Activity Monitor showed it was searching the disk). If I select
ASsave from the list, then the script once again looks fine and
functions properly. Now I close it again. Forever after, if I open
the script with ASsave not running, it instead reads
tell application "Script Editor"
«event ASs doit»
end tell
which of course doesn't work.
Also, is there anything funky about your application, like you
forgot to give it a Bundle ID or something?
No, it has a bundle id. And, as I mentioned, I added a creator code too.
Derrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden