UI scripting is handy for a whole bunch of stuff, Willem - but in this case, there's a rather easier and better way to achieve the same result:
.... and...
The 'random' settings don't affect the static desktop image. All it does is tell Dock.app to draw a new image layer on top the static desktop picture. This is why, after setting a desktop image with applescript, you won't see the image until you uncheck the 'Chang picture' option in system preferences. It would be interesting to learn how exactly System Preferences
But I dont want to uncheck the 'Change picture'. I do not want one picture but want to select the folder 'abstract' in one script and 'nature' in the other script, with the 'change picture' selected.
I have a script now and it works. And as you can see, not very elegant so if there is a other way to do this, I am all ears.
tell application "System Events" if UI elements enabled then click menu item "Bureaublad en schermbeveiliging" of menu "Weergave" of menu bar 1 of process "System Preferences" keystroke tab using {shift down} -- forward tab key keystroke (ASCII character 30) -- up arrow key keystroke (ASCII character 30) -- up arrow key keystroke (ASCII character 30) -- up arrow key keystroke (ASCII character 30) -- up arrow key keystroke (ASCII character 30) -- up arrow key keystroke (ASCII character 30) -- up arrow key keystroke (ASCII character 30) -- up arrow key --De bovenste is nu geselecteerd, nu naar beneden in de lijst. Natuur staat op de tweede plaats, abstract op 5, dus dan 4 keer kopieren keystroke (ASCII character 31) -- down arrow key keystroke (ASCII character 31) -- down arrow key keystroke (ASCII character 31) -- down arrow key keystroke (ASCII character 31) -- down arrow key
else tell application "System Preferences" set current pane to pane "com.apple.preference.universalaccess" display dialog "UI element scripting is niet aan. Vink \"Activeer toegang voor hulpapparaten\" aan" end tell end if end tell
|