• 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: inconsistant AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inconsistant AppleScript


  • Subject: Re: inconsistant AppleScript
  • From: Nathan Day <email@hidden>
  • Date: Sat, 27 May 2006 16:07:12 +1000

Along a similar line download my NDAppleSriptObject project and take the NSAppleEventDescriptor category files from it, you do not need any of the other stuff.
The NSAppleEventDescriptor category adds a whole lot of methods for creating NDAppleEventDescriptors for calling AppleScript handlers, including conversion of paths and Cocoa Types to stuff AppleScripts can understand like, aliases, lists records etc.


On 26/05/2006, at 7:39 PM, Mike Abdullah wrote:

Also, if you're needing to add stuff to your script I would suggest doing it like this instead:

http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers- from-cocoa

It is much neater than trying to piece together a working script in your app.

Mike.

On 25 May 2006, at 18:45PM, Jerrod Fowkes wrote:

Nir Soffer <email@hidden> wrote:
The script may use some data that is only available when you are in
Script Editor. Try to isolate the part of the script that does not
run, and post it here.

Ok, I did just so.

I found this line was causing it to bomb :
set absolute_filename to ":" & root_folder & ":" & user_folder & ":" & music_folder & ":" & product & ":" & publication & ":" & date_folder & ":" & filename as alias


which yields to the eye as something like: ":Users:username:Music:product:publication:12312005:filename.mp3"

when Script Editor ran it, it put the startup disk volume name in front of absolute_filename for me which mine is Macintosh HD so when I output it it actually read:

"Macintosh HD:Users:username:Music:product:publication: 12312005:filename.mp3"

so when I thought that using the same script in a cocoa application it would do the same thing, it actually wasn't putting the "Macintosh HD" in front of absolute_filename for me. which I am guessing that part is a "nice-ity" of Script Editor.

so I had to add another value:

set startup_disk to name of startup disk

and then :

set absolute_filename to startup_disk & ":" & root_folder & ":" & user_folder & ":" & music_folder & ":" & product & ":" & publication & ":" & date_folder & ":" & filename as alias

it works just fine now. this particular solution was fairly simple. However, if there are any more querks in Script Editor and using NSAppleScript I would like to know if there is a resource out there that I could use and learn. I will give AppleScript the benefit of that this is my first experience using AppleScript, let alone calling it from a cocoa Application. Knowing that there appears to be soubtle differences in calling scripts doesn't help to further my education in AppleScript.

So my question still stands. What is the underlying differences in when it gets executed in Script Editor and Cocoa?

If there are differences, then where can I access those differences as a reference resource?

-Jerrod



---------------------------------
How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.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

_______________________________________________ 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: 
 >Re: inconsistant AppleScript (From: Jerrod Fowkes <email@hidden>)
 >Re: inconsistant AppleScript (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Separators in NSPopUpButton via bindings
  • Next by Date: Newbie Q: Xcode strangeness
  • Previous by thread: Re: inconsistant AppleScript
  • Next by thread: Re: inconsistant AppleScript
  • Index(es):
    • Date
    • Thread