Re: Picture not aways replaced
Re: Picture not aways replaced
- Subject: Re: Picture not aways replaced
- From: "koenig.yvan" <email@hidden>
- Date: Mon, 06 Jan 2014 19:05:13 +0100
Le 05/01/2014 à 16:02, Robert Poland < email@hidden> a écrit : Hi,
Below is a piece of a script I use to change all desktop “Spaces” to the same picture.
The problem I’m running into is that if the current picture has the same name as the newer one (maybe it was modified), it is not replaced.
Any ideas?
— Script tell application "System Events" to key code 18 using {control down} -- Desktop 1 delay 1 repeat (numSpaces) times tell application "System Events" tell current desktop set picture to ThePicture tell me to beep # Edited this way to get rid of non fatal error -1708 end tell delay 1 -- switch to the next desktop tell application "System Events" to key code 124 using {control down} -- ^→ delay 1 end tell -- application "System Events" end repeat beep 2 tell application "System Events" to key code 18 using {control down} -- Desktop 1 — end of Script
TIA,
Robert Poland - Fort Collins, CO
The system compares only the new pathname to the in use one. When they are the same, it "think" that you are trying to reinstall the in use one and do nothing.
Try to use this edited version :
— Script tell application "System Events" to key code 18 using {control down} -- Desktop 1 delay 1 repeat (numSpaces) times tell application "System Events" tell current desktop set picture to path2fakePicture # ADDED delay .2 # ADDED set picture to ThePicture tell me to beep # Edited this way to get rid of non fatal error -1708 end tell delay 1 -- switch to the next desktop tell application "System Events" to key code 124 using {control down} -- ^→ delay 1 end tell -- application "System Events" end repeat beep 2 tell application "System Events" to key code 18 using {control down} -- Desktop 1 — end of Script
path2fakePicture is supposed to be the pathname of a picture file which you never use as a background. Maybe a nil string "" would do the trick but I'm not sure. The delay may be too short.
Yvan KOENIG (VALLAURIS, France) lundi 6 janvier 2014 19:04:48
|
_______________________________________________
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