I am trying to set the desktop picture in OS X with applescript. This code worked in 10.6-10.8 but is broken in Mavericks (10.9).
tell application "System Events"
    tell current desktop
        set picture to POSIX file "/development/desk/x.jpg"
    end tell
end tell
I know they changed how multiple monitors are supported but I am not sure what might have broken this.
Thanks to this github project this works. Perhaps the idea of a default desktop does not exist in 10.9?
    tell application "System Events"
        set theDesktops to a reference to every desktop
        repeat with x from 1 to (count theDesktops)
            set picture of item x of the theDesktops to "/development/desk/x.jpg"
        end repeat
    end tell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With