• 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: Osascript: Portable Path to Icon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Osascript: Portable Path to Icon


  • Subject: Re: Osascript: Portable Path to Icon
  • From: has <email@hidden>
  • Date: Wed, 13 May 2015 20:30:52 +0100

Oakman wrote:

>> You are using `osascript` to execute an actual AppleScript file, not just passing lines of AS code directly via `-e` options, yes?


> osascript -e 'set iconPath to ((path to applications folder as text) ...

Well there you are then. The script isn't loaded from a file, so there isn't going to be a file path for it regardless of what's running it. (As I say, the *correct* behavior would be for `path to me` to raise an "unknown/no file" error here, not return an incorrect value, but AppleScript.)

Either put the AS code in its own file or pass the appropriate path as an argument to `osascript`, like this:

    osascript  -e 'on run {filePath}'  -e ...  -e 'end run' "$filePath"

HTH

has


_______________________________________________
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


  • Follow-Ups:
    • Re: Osascript: Portable Path to Icon
      • From: Oakman <email@hidden>
  • Prev by Date: Re: Osascript: Portable Path to Icon
  • Next by Date: Re: Osascript: Portable Path to Icon
  • Previous by thread: Re: Osascript: Portable Path to Icon
  • Next by thread: Re: Osascript: Portable Path to Icon
  • Index(es):
    • Date
    • Thread