Title: Concatenating paths in AppleScript
Hi all,
I’m trying to write a script that plays a sound using David Blache’s Play Sound scriptlet. When messages personally addressed to me are received (Entourage X SR-1), the script is activated from a rule and tells the Play Sound application to play a pre-specified System 7 sound file. This works great when I hard-code the path to the sound file inside the script, but I’d like to write the script so that it will operate regardless of the HD name or user name. The version I’ve written doesn’t concatenate the pathname correctly:
set cusrPath to (path to "cusr")
set soundAlias to (cusrPath & "Documents:Microsoft User Data:Custom Sounds:Personal.sfil") as alias
tell application "Play Sound"
play sound soundAlias
quit
end tell
The second line produces a result of...
“HD:Users:JoeSchmoe:”,”Documents:Microsoft User Data:Custom Sounds:Personal.sfil”
...whereas clearly I don’t want the extra quotations and comma in between the two strings. I’m sure there’s a good way to do the concatenation and am hoping somebody can simply point it out for me. Once I get it working I’ll post it if there’s any interest.
Thanks in advance!
Justin
- Re: Concatenating paths in AppleScript Justin Mayer
- Re: Concatenating paths in AppleScript Paul Berkowitz
