title: AppleEvent Handler failed (-10000)
body: <p>I'm having issues with a simple part of script, where I wanna get the property <code>dock preferences</code> of System Events. I have the following:</p>
  
  <pre><code>tell application "System Events"
      tell appearance preferences
          set ap_prefs to (get the properties)
          set ap_prefs to the properties
      end tell
      set a_pref to the properties of appearance preferences
  
      -- Error Part
      tell dock preferences
          set d_prefs to (get the properties)
      end tell
      set d_pref to the properties of dock preferences
  end tell
  </code></pre>
  
  <p>In the code above I access <code>appearance preferences</code> in all the ways shown above, but not <code>dock preferences</code>. It give an error <code>error "System Events got an error: AppleEvent handler failed." number -10000</code>. </p>
  
  <p>So what is going on, and why is only giving error with dock? <a href="https://stackoverflow.com/a/9207884/3657151">Here</a> @dj_bazzie_wazzie says:</p>
  
  <blockquote>
    <p>Error -10000…most of the time it is not a target error but an incomplete command or wrong usage of brackets. </p>
  </blockquote>
  
  <p>But I can't figure out what is the proper way. I've tried all I can think of, also why doesn't it throw the exception for <code>appearance preferences</code>?</p>
  
  <p>Cheers</p>