1

I'm having issues with a simple part of script, where I wanna get the property dock preferences of System Events. I have the following:

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

    tell dock preferences
        set d_prefs to (get the properties)
    end tell
    set d_pref to the properties of dock preferences
end tell

In the code above I access appearance preferences in all the ways shown above, but not dock preferences. It give an error error "System Events got an error: AppleEvent handler failed." number -10000.

So what is going on, and why is only giving error with dock? Here @dj_bazzie_wazzie says:

Error -10000…most of the time it is not a target error but an incomplete command or wrong usage of brackets.

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 appearance preferences?

Cheers

I've also opened this question on Stack Overflow, I'll close one when I get a answer.

2
  • Cross-posting is frowned upon. Pick one & delete the other.
    – Tetsujin
    Commented Aug 16, 2015 at 15:57
  • I've seen that error when a variable expecting a POSIX file is given a string instead. Not quite sure on 'properties', though, which iirc ought to be a list... but it might be a start-point
    – Tetsujin
    Commented Aug 16, 2015 at 16:03

2 Answers 2

1

This works for me in the latest version of macOS Sierra...

tell application "System Events"
    set dockPrefs to dock preferences
    set appearancePrefs to appearance preferences
end tell
0

this is not really an answer but a detailed "comparison".
When I had your code run on my Mac (El Capitan), including your malfunctioning "set d_prefs to the properties" line, I didn't get an error at all.
Results window in ScriptEditor read:

{minimize effect:scale, magnification size:0.178571432829, ¬
dock size:0.116071425378, autohide:true, animate:false, ¬
magnification:false, screen edge:left, class:dock preferences object}

I wonder if you tried to get these values displayed/changed and called them by index?
I just read that: "You can retrieve items from a record [= list of properties] by name, but not by index."
Maybe that's where the error came from?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .