My memory was wrong, the tip was not delivered a few words ago.
It was before 2010/06/16 because I have an applet in which I use it created/modified at this date.
So, maybe this memory was also wrong about the media in which I got the tip. Maybe it was in MacScripter.
When my G5 died, I didn't import my old mails in the new machines so, I can't search among them.
Here is the named script.
--[SCRIPT récupérer_restaurer_position_icônes]
(*
Enregistrer le script en tant que Progiciel (Application sous 10.6.x) : récupérer_restaurer_position_icônes.app
Installer dans le Dock.
Sélectionner les icônes du bureau dont la position doit pouvoir être rétablie.
Lancer le script
Cliquer le bouton "Enregistrer leur position"
Un fichier texte contenant les informations relatives à ces icônes sera créé dans le dossier défini à partir de la property 'dest'
Par défaut c'est dans "<startupVolume>:Users:<userAccount>:Library:Application Support:".
Pour remettre les icônes en place, lancer l'application et cliquer le bouton "Rétablir leur position"
--=====
Save the script as an Application Bundle (Application under 10.6.x) : récupérer_restaurer_position_icônes.app
Install it in the Dock for easy access.
Select Desktop's icons whose location must be reset when needed.
Run the script.
Click the button "Get there position".
A text file containing the datas linked to these icons will be created in the folder defined according to the property 'dest'.
Default location is : "<startupVolume>:Users:<userAccount>:Library:Application Support:".
Run the script and click the button "Reset there position" to move the icons back to their original location.
--=====
bureau_complet KOENIG (VALLAURIS, France)
2010/03/16
*)
--=====--=====
property tout_le_bureau : true
property dest : 3
(*
1 = liste dans : "<startupVolume>:Users:<userAccount>:Library:Preferences:"
2 = liste dans : "<startupVolume>:Users:<userAccount>:Applications:Utilities:"
3 = liste dans : "<startupVolume>:Users:<userAccount>:Library:Application Support:"
*)
property nomDuRapport : "position des icones.txt"
property rapport : {}
--=====
on run
run script mon_script
end run
script mon_script
my nettoie()
if dest = 1 then
set p2d to path to preferences as text (*
"<startupVolume>:Users:<userAccount>:Library:Preferences:" *)
else if dest = 2 then
set p2d to path to utilities folder from user domain as text (*
"<startupVolume>:Users:<userAccount>:Applications:Utilities:" *)
else
set p2d to (path to library folder from user domain as text) & "Application Support:" (*
"<startupVolume>:Users:<userAccount>:Library:Application Support:" *)
end if
set p2r to p2d & nomDuRapport
if my parleAnglais() then
set prompt to "What to do with icons ?"
set {btn1, btn2, btn3} to {"Cancel", "Get their position", "Reset their position"}
else
set prompt to "Que faire avec les icônes ?"
set {btn1, btn2, btn3} to {"Abandonner", "Enregistrer leur position", "Rétablir leur position"}
end if
set maybe to button returned of (display dialog prompt buttons {btn1, btn2, btn3} default button 3)
if maybe is btn1 then (*
Cancel / Annuler *)
error number -128
else if maybe is btn2 then (*
Get their position / Enregistrer leur position *)
tell application "Finder"
set itms to name of every item of the desktop
repeat with itm in itms
try
set {x, y} to get desktop position of item itm
copy "" & itm & return & x & ", " & y to end of my rapport
end try
end repeat
end tell -- Finder
set rapport to my recolle(my rapport, return)
(*
crée un fichier texte dans le dossier "Bibliothèque:Application Support" du compte utilisateur *)
tell application "System Events"
if exists file p2r then delete file p2r
make new file at end of folder p2d with properties {name:nomDuRapport}
end tell -- System Events
write rapport to (p2r as alias)
else (*
Reset there position / Rétablir leur position *)
set my rapport to paragraphs of (read file p2r)
repeat with i from 1 to ((count of rapport) - 1) by 2
try
set itm to item i of rapport
tell application "Finder" to set desktop position of item itm to my decoupe(item (i + 1) of rapport, ", ")
end try
end repeat
tell application "Finder" to update folder p2d
end if
my nettoie()
end script
--=====
on nettoie()
set my rapport to {}
end nettoie
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
on recolle(l, d)
local t
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to ""
return t
end recolle
--=====
on parleAnglais()
local z
try
tell application "Finder" to set z to localized string "AL1"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]