title: AppleScript: How to identify checkbox location in System Preferences?
body: <p>I want to issue a keyboard command to toggle the checkbox "Change picture every 30 minutes" in <code>OS X</code> for <code>Desktop 1</code> (my main monitor desktop). I have multiple monitors so it may be necessary to identify which particular preference pane to manipulate.</p>
  
  <p>I have set up the start of an AppleScript, but I'm at a loss how to formulate how to identify this particular check box:</p>
  
  <pre><code>tell application "System Preferences"
      activate
  end tell
  
  tell application "System Events"
      tell process "System Preferences"
          click menu item "Desktop &amp; Screen Saver" of menu "View" of menu bar 1
      delay 2
      tell window "Desktop &amp; Screen Saver"
          click checkbox 1 of …
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eNh2Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eNh2Z.png" alt="enter image description here"></a></p>