Hi, I posted this in the wrong forum, so here it is…
When I try to run this it says Can’t set “Appletalk” to false. Access not allowed.
I don’t understand what I’m doing wrong.
I know the display dialog isn’t set up yet, that’s the least of my worries.
I just have to get the other stuff working first.
any help would be fantastic
display dialog "Turn Appletalk" buttons {"Off", "On"}
tell application "System Events"
if UI elements enabled then
tell application "System Events"
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.network"
set "Appletalk" to false
end tell
end tell
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
BTW, did you know you can create locations for different configurations of your network settings. Then, you can go to the Apple menu > Location and select one of your locations. For instance, I created a location called AppleTalkInactive. So, if I wanted to turn off AppleTalk, I could just go to the Apple menu and turn of AppleTalk. You could also do this through script. This script works on my machine to select my AppleTalkInactive location:
– assumes the fornt process has a menu bar
tell application “System Events”
set front_process to (name of first process whose frontmost is true)
tell process front_process
tell menu bar 1
tell menu “Apple”
tell menu item “Location”
tell menu “Location”
click menu item “AppleTalkInactive”
end tell
end tell
end tell
end tell
end tell
end tell
Of course, if you use a lot of different network settings, then this might not be feasible, because you would need many different locations with AppleTalk inactive.