Re: Posix Path
Re: Posix Path
- Subject: Re: Posix Path
- From: Deivy Petrescu <email@hidden>
- Date: Sat, 11 Mar 2017 11:50:36 -0500
> On Mar 11, 2017, at 11:39 , Daniel Chavez <email@hidden> wrote:
>
> Good day,
> I'm trying to figure out why sound files in a certain folder aren't playing for certain user's who run my application.
> My main issue here is that I have the sound files in a folder called, netutils/contents/resources/sounds.
> My secondary issue is that, the path of the sound files have to correspond to various volume names as the app runs on different mac's, who's volume names will be different from my own.
> I have the following code, which runs on my own Mac fine, but gives an error on other Mac computer's:
> use scripting additions
> use framework "Foundation"
> use framework "AppKit"
> set theFile to POSIX path of "Phoenix:Applications:netutils:sounds:logo.mp3"
> set theSound to current application's NSSound's alloc()'s initWithContentsOfFile:theFile byReference:false
> tell theSound to play()
>
> The above code plays logo.mp3 from within the Phoenix:Applications:netutils:sounds folder. However, I am looking to have the code take into effect that the sounds should play from just the netutils/contents/resources/sounds folder while also having the code to realize that not all volume names will be the same as my own, for instance some volumes will be called MacHD, as an example.
>
> So my question overall is, what path syntax can I use to achieve what I've outlined?
> Thanks for any help that can be provided.
> _______________________________________________
>
You don’t mention, but I assume netutils is going to be in the Application folder for every user.
if so, this should work:
——
path to “apps”
——
It returns the path to Applications no matter what is the name of the HD.
Deivy Petrescu
email@hidden
_______________________________________________
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>) |