I need help making an apple script that'll open a program in system preferences

Hi. I'm new to these forums, but I need help creating a macro that'll first open the Network Link Conditioner(shown here)

and then would trigger the on/off button (shown here) I tried using this macro to achieve the same thing(shown here) but it doesn't work that well. Any help will be appreciated!! :slight_smile:

I don't have that SP add-in, but maybe this AppleScript can help you identify the button that turns it on/off:

property paneID : "com.apple.Network-Link-Conditioner"
tell application "System Preferences"
  activate
  set the current pane to pane id paneID
end tell

delay 0.5

tell application "System Events"
  tell application process "System Preferences"
    set oWin to window 1
    oWin
  end tell
end tell

If you run this in Script Debugger 7 , you will see a hierarchical list of elements in that pane, like this example from another pane:

From that you should be able to identify the button/element for the on/off switch.
Most likely you will want to set its "value" property to "0" for off and "1" for on.

If you need help with the script, post a screenshot showing the details of the element of interest.

Here's what came up.

In order to be useful, you will need to explore, drill-down, into the window element hierarchy and find the element of interest.

The screenshot will be easier to read if you will:

  1. Expand the upper results pane to show all of the hierarchy
  2. Capture ONLY the results area, as I did in my above example.

Sorry, are these screenshots good?


Thanks in advance! :smiley:

Much better!

Do these look like the buttons you want to control:

image

If so, then fully expand each so we can see all of the properties and elements.

If not, then find the buttons of interest, and expand them.

Here you go :smiley:

:smiley:

Are you there? :worried:

Yes, but I am very busy. It may be a few days before I can continue to help you.
Meanwhile, you have all the tools you need to solve this problem. Exploring in SD7 and some trial-and-error scripts can lead you to a solution.