• 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: Invoke Unix Tool in Script Application Bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoke Unix Tool in Script Application Bundle


  • Subject: Re: Invoke Unix Tool in Script Application Bundle
  • From: Philip Aker <email@hidden>
  • Date: Thu, 02 Oct 2008 19:33:51 -0700

On Oct 2, 2008, at 5:53 PM, Jerry Krinock wrote:

I need to write a unix program ("command line tool") in C/Cocoa/ Carbon to access some API that are not available in AppleScript. (Specifically, I need to parse and decode a base-64 encoded File Alias that is stored in a file, and convert it to a unix path.) I want to ship this tool inside an AppleScript application package, so that my user only gets one package to doubleclick and run.

So, here's what I plan to do: Save script as application bundle, put the tool in the bundle's Contents/MacOS. In the script, run the tool with something like

set toolPath to ((POSIX path of (path to me)) as string) & "/ Contents/MacOS/" & toolName
do shell script toolPath & arguments, ... etc.

I'd appreciate hearing from anyone who has tried anything like this, and/or can suggest a better way, before I dig myself in too deeply.

Always use 'quoted form of …' for your paths and argument list.

There can be the odd problem if you have to support international users for both 10.4 and 10.5 because the text encoding for scripts in 10.4 is "native" and the encoding on 10.5 is Unicode. If you run into them, the solution appear to be:

1. Make sure your text script is in UTF-8 encoding,
2. Convert it to UTF-16 with 'iconv'
3. Compile and save the UTF-16 with Script Editor on 10.4


Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

_______________________________________________
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
References: 
 >Invoke Unix Tool in Script Application Bundle (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Invoke Unix Tool in Script Application Bundle
  • Next by Date: Re: Invoke Unix Tool in Script Application Bundle
  • Previous by thread: Re: Invoke Unix Tool in Script Application Bundle
  • Next by thread: Re: Invoke Unix Tool in Script Application Bundle
  • Index(es):
    • Date
    • Thread