|
|
Get the name of the current desktop image
I always enjoy a little experimentation, so as was suggested, I've been fooling with defaults read and I can't get the output that I'd like -- I can't simply pull up the name of the current picture under Tiger.
...produces the same results as...
...which is a dump of the whole file. Either I'm doing it wrong or else there's a bug that prevents it from reading nested items.
This is an alternative...
...but as I indicated earlier, in my own .plist file, there's a lot of junk, including entries for desktop images that are NOT the one being displayed on my monitor. So when I grep for LastName, I get 11 results rather than one.
Any ideas?
Get the name of the current desktop image
[code]defaults read com.apple.desktop | grep -A 10 default | grep ImageFilePath | awk -F= '{print $2}' | sed -e 's/";/"/'[/code]
Get the name of the current desktop image
Thanks!
That was helpful, but when I ran it, the result was the path to an image that was NOT being displayed as my desktop image.
However, both of these worked to produce the same results as the AppleScript...
...and this worked to find the name of the image on my second monitor...
Once again, I think it's important to stress that the way to find the correct property list item is to browse through the .plist file and to use the LastName property.
I think that if you've only ever displayed one image as your desktop image since your last clean install, the ImageFilePath field in the default property list entry is going to match the file referenced in the LastName field, but if you are randomizing your screens, they are going to be different. Also, if you are anything like me where I haven't done a clean install on this particular Mac since 10.2, the .plist file is going to have a lot of obsolete and redundant entries and the ImageFilePath won't have any relationship at all to the present location of your image files.
So, anyway... this is the AppleScript that I derived from your code...
...where "1983938400" and "552268546" are the .plist items that store the names of my current desktop images.
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.07 seconds |
|