Is there a way to get the path of the current desktop background picture when it’s set to rotate in a folder of images in Lion?
I can’t figure out how to do it. The following works if the desktop background is static
tell application "System Events"
picture of current desktop
end tell
But when the desktop background is set rotate in a folder then the above still returns the previously chosen static picture and not the one that’s in use at the moment.
tell application "System Events"
pictures folder of current desktop
end tell
returns the folder but not the actual picture.
I thought this might be possible using ASOC but so far I can’t manage.
The following works when the desktop background is static
script x
set curscreen to current application's NSScreen's mainScreen()
set curdesktop_background to current application's NSWorkspace's sharedWorkspace()'s desktopImageURLForScreen_(curscreen)
curdesktop_background's |path|
end script
tell application "ASObjC Runner" to run the script {x} with result returned
but it only return the path to the folder when the background is set to rotate.
After some poking around I found that I can read off the path to the actual picture from com.apple.desktop.plist but in order to choose the right one I need to know the UUID of the currently active space in mission control. But I don’t know how to do that. All references to spaces are gone from the System Events dictionary in Lion. have they moved somewhere else or are they just not available anymore? I don’t see any mention of Mission Control in any of AS dictionaries either. How about Cocoa then? any way to get spaces UUIDs using AppleScriptObjC?