I've written this applescript to mount an AFP volume whenever I am on a certain wireless network. It works just fine, but I am trying to keep from having to hit enter every time it mounts the designated share. My login information is saved in the keychain, I just can't seem to get the Applescript to press "Connect" for me. I know it might sound lazy, but isn't that the point of Applescript? I used UI inspector to figure out the parameters of the "Connect" button.
Does anyone know how to fix this script so that I do not have to hit enter every time it mounts? Thanks.
Does anyone know how to fix this script so that I do not have to hit enter every time it mounts? Thanks.
set AirportName to do shell script ¬
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | sed '/ SSID: /!d; s/^.* SSID: //'"
tell application "Finder"
activate
if AirportName is "Home" then mount volume "afp://Volume/Share" as user name ¬
"user"
tell application "System Events"
tell process "AFP Client"
click button "connect" of window "Connect to Server"
end tell
end tell
end tell