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

Re: Posix Path


  • Subject: Re: Posix Path
  • From: Shane Stanley <email@hidden>
  • Date: Sun, 12 Mar 2017 17:27:22 +1100

On 12 Mar 2017, at 9:08 am, email@hidden wrote:

So my code below does work.

set theFile to POSIX path of ((path to applications folder as text) &
"netutils:contents:resources:sounds:logo.mp3")

Rather than spelling out the path within the app, which is easy to get wrong, you can use something like this:

set theFile to POSIX path of (path to resource "logo.mp3" in bundle alias ((path to applications folder as text) & "netutils") in directory "sounds")

Or, as you're using ASObjC already, something like this should be even more forgiving:

set appPath to current application's NSWorkspace's sharedWorkspace()'s fullPathForApplication:"netutils"
set appBundle to current application's NSBundle's bundleWithPath:appPath
set theFile to appBundle's pathForSoundResource:"logo.mp3"

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
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: 
 >Posix Path (From: Daniel Chavez <email@hidden>)
 >Re: Posix Path (From: email@hidden)

  • Prev by Date: Re: Posix Path
  • Next by Date: Re: Differences in output between AppleScript and Terminal
  • Previous by thread: Re: Posix Path
  • Next by thread: Question on keywords
  • Index(es):
    • Date
    • Thread