• 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: Saving an AppleScript that targets my own application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving an AppleScript that targets my own application


  • Subject: Re: Saving an AppleScript that targets my own application
  • From: Daniel Jalkut <email@hidden>
  • Date: Wed, 11 Jan 2006 23:30:21 -0500

Hi Derrick - I downloaded your sample and it also worked fine on my machine. Maybe something has gone wacky on your machine, as as side- effect of having developed the app there. I don't know what the current voodoo incantations are to "clean up the database" with regard to LaunchServices and all that, but you might look into that. Sorry I couldn't be more helpful, but it does seem to work here.

Daniel

On Jan 11, 2006, at 10:44 PM, Derrick Bass wrote:

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:
sweater.com


This email sent to email@hidden

_______________________________________________ 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
References: 
 >Saving an AppleScript that targets my own application (From: Derrick Bass <email@hidden>)
 >Re: Saving an AppleScript that targets my own application (From: Daniel Jalkut <email@hidden>)
 >Re: Saving an AppleScript that targets my own application (From: Derrick Bass <email@hidden>)

  • Prev by Date: Re: Help, How to resize a window on cocoa
  • Next by Date: timeout on -[NSData dataWithContentsOfURL:] ?
  • Previous by thread: Re: Saving an AppleScript that targets my own application
  • Next by thread: Re: Saving an AppleScript that targets my own application
  • Index(es):
    • Date
    • Thread