|
|
#1 |
|
Registered User
Join Date: May 2006
Posts: 1
|
hey
I'm not sure if this is the right place for this, but; is there a way to display the name of my current desktop picture? I have 1200 or more pictures in a folder changing randomly. when I decide I would like to get rid of one it takes 10 minutes to find it. thanks for your help bb |
|
|
|
|
|
#2 |
|
Major Leaguer
Join Date: Mar 2006
Posts: 335
|
Here's the AppleScript to snag the name from my computer. You'll have to look in your own com.apple.desktop.plist file (at ~/Library/Preferences) to see if the path is the same (I suspect that it's not). Use the Property List Editor to view the pref's file properly.
Code:
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) & "com.apple.desktop.plist")) display dialog my_desktop end tell
Last edited by 6502; 05-07-2006 at 06:55 AM. |
|
|
|
|
|
#3 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
That didn't work on my system. But this (modified version of your script) does work: Code:
tell application "System Events" set my_desktop to value of (property list item "ImageFilePath" 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 my_desktop to my_desktop as text display dialog my_desktop end tell
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#4 |
|
Major Leaguer
Join Date: Mar 2006
Posts: 335
|
Looking at the ImageFilePath item in my .plist file, I see a significant problem with using it.
On my Mac, it shows the path to the first image that I selected from my screens folder. It doesn't show the path to the current file being randomly selected from that folder. Do you get the full path that way? Or just the file name? I assumed that the goal was to snag just the file name. ...and in playing around, I just noticed that I don't have to coerce my_desktop to text. I've modified my original post to reflect that change. ...and looking at the path you're using, I can tell there's a SIGNIFICANT difference between our .plist files. There's no such entry for an item "default" in mine. Last edited by 6502; 05-07-2006 at 07:14 AM. |
|
|
|
|
|
#5 |
|
Major Leaguer
Join Date: Mar 2006
Posts: 335
|
Oh! Playing with your code, I can see that I don't need to have a literal .plist entry for "default."
It sort of works, but it pulls up the path to the first image that I selected from that folder rather than displaying the name or path of the current desktop image. I think you need to use the value of the LastName plist item. |
|
|
|
|
|
#6 |
|
Registered User
Join Date: May 2006
Posts: 1
|
thanks a lot for the help, I know almost nothing about this but I tried to follow what you were saying and ended up with this;
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 my_desktop to my_desktop as text display dialog my_desktop end tell and it works! thanks again. bb |
|
|
|
![]() |
|
|