• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Issues Automating Internet Sharing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issues Automating Internet Sharing


  • Subject: Issues Automating Internet Sharing
  • From: Kyle Anderson <email@hidden>
  • Date: Sun, 28 Jun 2009 23:40:36 -0700

Hey there,

This is my first dabble in AppleScript, and my code is probably not as efficient as it could be.

I'm trying to automatically change the Internet Sharing "Connection From" pop up menu from one value to another, the value for which is determined using an if else statement. The problem is that every time the script opens the Sharing pane, the "Connection From" menu is always reset to AirPort and returns that value, even if I manually set the connection to VPN before running the script. Here's the code:

tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preferences.sharing"
end tell
tell application "System Events"
    tell application process "System Preferences"
        click checkbox 1 of row 10 of table 1 of scroll area 1 of group 1 of window 1
        if the value of pop up button 1 of group 1 of window 1 is "AirPort" then
            click pop up button 1 of group 1 of window 1
            click menu item "NAU VPN" of menu 1 of pop up button 1 of group 1 of window 1
        else if the value of pop up button 1 of group 1 of window 1 is "NAU VPN" then
            click pop up button 1 of group 1 of window 1
            click menu item "AirPort" of menu 1 of pop up button 1 of group 1 of window 1
        end if
        click checkbox 1 of row 10 of table 1 of scroll area 1 of group 1 of window 1
        click button 2 of sheet 1 of window 1
    end tell
end tell
tell application "System Preferences" to quit

I've also tried using the set command for the menu values instead of the UI .

Thoughts? Thanks in advance.


Kyle Anderson
http://xsquared.us/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Adding a Color Profile to an Image with Image Events
  • Next by Date: Jeffrey Madson/RMS/MOORE is out of the office.
  • Previous by thread: Re: Adding a Color Profile to an Image with Image Events
  • Next by thread: Jeffrey Madson/RMS/MOORE is out of the office.
  • Index(es):
    • Date
    • Thread