Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Get the name of the current desktop image' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Get the name of the current desktop image
Authored by: 8008135 on Sep 16, '06 02:52:29PM
i'm a complete noob to code but i managed to update this script a little... i found that 'open' wasn't working because it didn't include address for the file. i think that with further modifications this could be made into a useful image sorting utility. just link the shell script 'cp' call to a hotkey, and set the changetime variable in the desktop plist file to a low value. meaning that when gathering images together you could just slideshow your way through a folder tapping a hotkey everytime you see a picture that you need.

tell application "System Events"
	
	set my_desktop to value of (property list item "LastName" of ¬
		property list item "default" of property list item ¬
		"Background" of property list file ¬
		((path to preferences as Unicode text) & ¬
			"com.apple.desktop.plist"))
	
	set folder_path to value of (property list item "ChooseFolderPath" of ¬
		property list item "default" of property list item ¬
		"Background" of property list file ¬
		((path to preferences as Unicode text) & ¬
			"com.apple.desktop.plist"))
	
	set rep to display dialog "The current Desktop Picture is named " & return & """ & my_desktop & """ buttons {"Open File", "Copy to Clipboard", "Copy to Desktop"} default button 3
	set finder_path to folder_path & "/" & my_desktop
	if button returned of rep is "Copy to Clipboard" then set the clipboard to my_desktop
	if button returned of rep is "Open File" then open finder_path
	if button returned of rep is "Copy to Desktop" then do shell script "cp " & finder_path & " ~/desktop"
end tell


[ Reply to This | # ]