• 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: best practice with helper AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: best practice with helper AppleScript


  • Subject: Re: best practice with helper AppleScript
  • From: Matt Gemmell <email@hidden>
  • Date: Wed, 25 Jun 2003 03:03:59 +0100

On 24/6/03 at 2:19 am, Christopher Corbell said:

> I can easily put the script in the app bundle, the problem is that
> I don't know how to pass an argument to it when I launch it.
> Is there an easy way to do this in Cocoa, without having to
> treat the script as an application and stuff Apple Event descriptors?
>
> What does everyone else do?

When I wrote iCal Birthday Shifter, I used a combination of those two
methods. I wrote the script and saved it as text, including that text
file in the app bundle. Part of the script made use of a variable that I
hadn't defined in the script, so if I'd run the script as-is, it would
have errored out, complaining about the unknown variable. The variable
would require to be different each time I ran the script.

At runtime, I simply read the text file into an NSString, prepended the
text "set myVar to \"whatever\"\n", and executed it via an NSAppleScript
instance. I dare say you could do the same with your file-path.

Cheers,
-Matt

--
Matt Gemmell
Scotland Software
http://www.scotlandsoftware.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >best practice with helper AppleScript (From: Christopher Corbell <email@hidden>)

  • Prev by Date: WebKit: Custom JS functions
  • Next by Date: Re: Strange warnings
  • Previous by thread: best practice with helper AppleScript
  • Next by thread: Re: best practice with helper AppleScript
  • Index(es):
    • Date
    • Thread