Pages

Thursday, March 14, 2013

Applescript/Shell Script reference to the app itself


Hi guys,


i have made an applescript with the following source code:


"


set sound_output to button returned of (display dialog "Select Output Source" buttons {"Computer", "TV"} default button "TV")


if sound_output is "Computer" then do shell script ("cd /Applications/SwitchAudioSource-v1; ./SwitchAudioSource -s 'Built-in Output'")


if sound_output is "TV" then do shell script ("cd /Applications/SwitchAudioSource-v1; ./SwitchAudioSource -s 'HDMI'")


"


I am wondering if there is a way to refer to the abovementioned executable ./SwitchAudioSource (currently located in /Applications) in my compiled applescript somewhere? That is:


Show Package Contents > Contents > Resources > and dump the executabe ./SwitchAudioSource here, and then modify my script to somehow refer to within itself so that my applescript will work regardless of where i place it. Desktop, /Users, even pictures,


i hope this makes sense, thankyou for all your help in advance, cheers mate 


View the original article here

0 comments:

Post a Comment