Page 1 of 1

If "connected" then ... Script

Posted: Mon Oct 14, 2013 3:15 am
by PiepRock
I want to write an AppleScript which lets Viscosity connect to a certain connection i named "Sweden"
But if Viscosity is already connected it should display a dialogue.
Please note i am a total new to that and i don't really know the Syntax at all.
This is what i have but it does not work at all:

tell application "Viscosity" activate
end tell

tell application "Viscosity"

if the state of the fourth connection is "disconnected" then
tell application "Viscosity" to connect "Sweden"

end tell

else if the state of the fourth connection is "connected" then
tell application "Viscosity"
display dialoge "already connected"

end tell

end if