Code: Select all
on idle
tell application "System Events"
tell current location of network preferences
set myConnection to the service "VPN (PPTP)"
if current configuration of myConnection is connected then
activate application "Transmission"
delay 15
tell process "Transmission"
click menu item "Resume All" of menu 1 of menu bar item "Transfers" of menu bar 1
end tell
else if current configuration of myConnection is not connected then
connect myConnection
if exists (activate application "Transmission") then
tell process "Transmission"
click menu item "Pause All" of menu 1 of menu bar item "Transfers" of menu bar 1
end tell
end if
end if
end tell
end tell
delay 33
end idle