

The whole thing from "set my_desktop" to the double-parentheses is one line unless you use the Option-Return character (¬) at each line break. If it's there then there's no good reason for the script not to work.ĭouble-check that your line-breaks are in the right places. You can double check that the property list commands are accessible in your Script Editor application by using the Open Dictionary command - select System Events.app in the resulting list and you should find an entry for the Property List Suite. System Events should be scriptable in 10.3. > "property"" and it's been many, many years since I dabbled in > systax error: "Expected expression, ")", etc.
#MAC DESKTOP PICTURES PLIST CODE#
> I tried this code in Script Editor on my 10.3.9 system and got a I think it will work in earlier OSes, but I haven't tried it in 10.3x. I'll leave the modification for two monitors to your own ingenuity.
#MAC DESKTOP PICTURES PLIST MAC#
I have my Mac set to cycle through the images kept in a single "Screens," folder and I have double-checked that it will snag the name of the file again after the image has cycled a few times. Then change the value in the script ( 1983938400 in the above code) to match the value of the appropriate LastName entry for your current desktop image. For this to work on your own system, you should open your own file with the Property List Editor.app, and see where the value for your current desktop image is kept. On my Mac running 10.4.5, there are actually several plist items under Background, each of which contain entries for desktop images that are not being displayed, so it took some poking around to find the correct path.Īpparently, there are some variations in the way that this. tell application "System Events" set my_desktop to value of (property list item "LastName" of ¬ property list item "1983938400" of property list item ¬ "Background" of property list file ¬ ((path to preferences as Unicode text) & ¬ "")) display dialog my_desktopend tellThis script looks in the file in your user's Library/Preferences folder for the name of the current desktop image. So here's the AppleScript that I came up with to solve that problem. Just like the original poster, I have a lot of desktop images, and sometimes I can't remember the name of the one that's currently displayed when I want to edit it (or trash it). I was replying to a question in the forums when I realized that this would make a great tip for the main site.
