T
thinkart23
Neues Mitglied
Thread Starter
- Dabei seit
- 08.06.2012
- Beiträge
- 13
- Reaktionspunkte
- 0
Hallo Zusammen,
ich bin grade an einem Script was auf Netzwerkumgebung zugreift,dort ist einmal Netzwerk "Privat" und "Öffentlich" hinterlegt.
Bei der Auswahl wird bei Öffentlich ein VPN gestartet und bei "Privat" soll kein VPN Starten.
Wie muß ich "Privat" im Script hinterlegen am besten?
tell application "System Events"
if UI elements enabled then
set UListe to title of every menu item of menu "Umgebung" of menu item "Umgebung" of menu "Apple" of menu bar 1 of process "Finder"
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
set UListe to items 1 thru -3 of UListe
set Auswahl to choose choose from list {"Automatisch", "Privat"} with prompt "Netzwerumgebung"
if Auswahl is not false then
set Befehl to "scselect " & Auswahl
do shell script Befehl
end if
if Auswahl is "scselect" & Auswahl then "Automatisch"
tell application "System Events"
tell current location of network preferences
set myConnection to the service "VPN"
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
end if
if Auswahl is "scselect" & Auswahl then "Privat"
ich bin grade an einem Script was auf Netzwerkumgebung zugreift,dort ist einmal Netzwerk "Privat" und "Öffentlich" hinterlegt.
Bei der Auswahl wird bei Öffentlich ein VPN gestartet und bei "Privat" soll kein VPN Starten.
Wie muß ich "Privat" im Script hinterlegen am besten?
tell application "System Events"
if UI elements enabled then
set UListe to title of every menu item of menu "Umgebung" of menu item "Umgebung" of menu "Apple" of menu bar 1 of process "Finder"
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
set UListe to items 1 thru -3 of UListe
set Auswahl to choose choose from list {"Automatisch", "Privat"} with prompt "Netzwerumgebung"
if Auswahl is not false then
set Befehl to "scselect " & Auswahl
do shell script Befehl
end if
if Auswahl is "scselect" & Auswahl then "Automatisch"
tell application "System Events"
tell current location of network preferences
set myConnection to the service "VPN"
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
end if
if Auswahl is "scselect" & Auswahl then "Privat"