Hello,
In the following script, I only want the phrase “volumes could not e found” spoken AFTER the script verifies that the connected said is correct and tries to mount the volumes unsuccessfully. So if the said does not equal the specified name in the script, I want no message to be spoken.
delay 2
do shell script "afplay '/Library/Audio/Sounds/script started.mp3'"
property primaryEthernetDevice : "en0"
property primaryWiFiDevice : "en1"
set {connected, wired, IPAddress, ssid} to getLocation()
if (connected and (ssid = "Fiorentino")) then
delay 1
tell application "Finder"
try
mount volume "smb://mediaserver/automatically add to iTunes/" as user name "Rocco Fiorentino" with password "rocco1020"
mount volume "smb://mediaserver/shared media" as user name "Rocco Fiorentino" with password "rocco1020"
end try
close windows
end tell
do shell script "afplay '/Library/Audio/Sounds/server.mp3'"
else
say "volumes could not be found."
end if
on getLocation()
set wiredIP to do shell script "/sbin/ifconfig " & primaryEthernetDevice & " | /usr/bin/awk '/inet / {print $2}'"
if wiredIP is not "" then
return {true, true, wiredIP, ""}
else
set wirelessIP to do shell script "/sbin/ifconfig " & primaryWiFiDevice & " | /usr/bin/awk '/inet / {print $2}'"
if wirelessIP is not "" then
set ssid to do shell script "/usr/sbin/networksetup -getairportnetwork " & primaryWiFiDevice & " | sed 's/Current Wi-Fi Network: //g'"
return {true, false, wirelessIP, ssid}
else
return {false, false, "", ""}
end if
end if
end getLocation
Thanks so much,
Rocco