• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Picture not aways replaced
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Picture not aways replaced


  • Subject: Re: Picture not aways replaced
  • From: "koenig.yvan" <email@hidden>
  • Date: Mon, 06 Jan 2014 10:25:46 +0100

OOPS, I posted to Neil, not to the forum.


Le 05/01/2014 à 19:01, Neil Laubenthal <email@hidden> a écrit :

On Jan 5, 2014, at 12:35 PM, Robert Poland <email@hidden> wrote:
Neil,

Maybe we could help if we saw your old script.

Yeah, I guess that would help, wouldn’t it…:-)

Here’s what used to work…and I’m way not smart enough about Applescript to know why it doesn’t work anymore. IIRC it broke about the same time Spaces came out so that was probably Lion I guess.

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"))

display dialog my_desktop
end tell

Here’s the error I get when running the script.

error "System Events got an error: Can’t get property list item \"default\" of property list item \"Background\" of property list file \"Brilliant3:Users:honeybear:Library:Preferences:com.apple.desktop.plist\"." number -1728 from property list item "default" of property list item "Background" of property list file "Brilliant3:Users:honeybear:Library:Preferences:com.apple.desktop.plist” 


It was easy to understand what is wrong.
In the default container of the com.apple.desktop.plist Preferences file there is no property entitled LastName.

There are two ones which may be useful for you :

ImageFilePath
which contains the unix path of the picture in the format :  /Users/yvankoenig/Pictures/ecsb_background_tile.png

NewImageFilePath
which contains the unix path of the picture in the format :  ~/Pictures/ecsb_background_tile.png

Here is an edited version which would work with every system knowing the system attribute "sys2" :

(system attribute "sys2")
tell application "System Events"
if result > 6 then # was 8 in the mail sent to Neil
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 name of disk item result
else
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"))
end if
display dialog my_desktop
end tell 

I don't have 10.6 available on a machine so I can't look if there was a property storing the pict pathname as there are in 10.7 and higher.


Yvan KOENIG (VALLAURIS, France) lundi 6 janvier 2014 10:22:16





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Picture not aways replaced (From: Robert Poland <email@hidden>)
 >Re: Picture not aways replaced (From: Neil Laubenthal <email@hidden>)
 >Re: Picture not aways replaced (From: Robert Poland <email@hidden>)
 >Re: Picture not aways replaced (From: Neil Laubenthal <email@hidden>)

  • Prev by Date: Re: Picture not aways replaced
  • Next by Date: Re: Picture not aways replaced
  • Previous by thread: Re: Picture not aways replaced
  • Next by thread: Re: Picture not aways replaced
  • Index(es):
    • Date
    • Thread