Applescript "do shell script" pros and cons
Are there significant advantages or disadvantages between including shell scripts in an AppleScript and using AppleScript commands?
I rarely use AppleScript so am a complete novice but wanted to save a script as an application to make sure my iTunes media share is available before starting iTunes. I've used "do shell script" to open iTunes but only because I couldn't get it to work properly otherwise.
tell application "Finder"
if (exists POSIX file "/Volumes/MediaForStreaming") then
do shell script "/Applications/iTunes.app/Contents/MacOS/iTunes > /dev/null 2>&1 &"
else
try
mount volume "afp://ipAddressOfNAS/MediaForStreaming"
do shell script "/Applications/iTunes.app/Contents/MacOS/iTunes > /dev/null 2>&1 &"
on error
display dialog "Can't mount media share on NAS."
end try
end if
end tell
It seems to do what I want although I've not tried to run it from anything other than Mojave nor as another user yet (it has to run on El Capitan as well). I've intentionally not included credentials in the mount parameters as I want it to use the credentials of the user running it.
iMac Line (2012 and Later)