--{code}
--[SCRIPT rule_application_state]
(*
Enregistrer le script en tant que Script : rule_application_state.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:
Aller au menu Scripts , puis choisir “rule_application_state”
Cliquer le bouton Activer ou le bouton Désactiver la fonction "Save Application State"
Ensuite, sélectionner les dossiers correspondant aux applications à gérer.
--=====
L’aide du Finder explique:
L’Utilitaire AppleScript permet d’activer le Menu des scripts :
Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case “Afficher le menu des scripts dans la barre de menus”.
Sous 10.6.x,
aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
--=====
Save the script as a Script: rule_application_state.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:
Go to the Scripts Menu, then choose “rule_application_state”
Click the button Enable or the button Disable the function "Save Application State"
Then, choose the folders linked to the applications to drive.
--=====
The Finder’s Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the “Show Script Menu in menu bar” checkbox.
Under 10.6.x,
go to the General panel of AppleScript Editor’s Preferences dialog box
and check the “Show Script menu in menu bar” option.
--=====
Yvan KOENIG (VALLAURIS, France)
2011/07/26
2011/07/30 edit the delete code. The original code behave well in 10.6.8 but fail in 10.7 ???
*)
--=====
on run
local Saved_Application_State, mon_choix
(*
Build the path to the folder embedding the subfolders to treat *)
set Saved_Application_State to (path to library folder from user domain as text) & "Saved Application State:"
(*
Define what way we want applications to behave *)
if my parle_anglais() then
set {prompt, bouton_quitter, bouton_desactiver, bouton_activer} to {"What to do with “Save Application State” ?", "Cancel", "Disable", "Enable"}
else
set {prompt, bouton_quitter, bouton_desactiver, bouton_activer} to {"Que faire de la fonction « Reprise » ?", "Annuler", "Désactiver", "Activer"}
end if
set mon_choix to button returned of (display dialog prompt buttons {bouton_quitter, bouton_desactiver, bouton_activer} cancel button bouton_quitter)
if mon_choix is bouton_activer then
(*
Enable the Save Applications State feature *)
if my parle_anglais() then
set mon_choix to choose folder with prompt "Choose the folder(s) linked to the application(s) whose Save Applications State feature must be enabled." default location (Saved_Application_State as alias) with multiple selections allowed without invisible
else
set mon_choix to choose folder with prompt "Choisissez les dossiers associés aux applications dont la fonction « Reprise » doit être activée." default location (Saved_Application_State as alias) with multiple selections allowed without invisible
end if
tell application "Finder"
repeat with un_dossier in mon_choix
set locked of un_dossier to false
end repeat
end tell
else
(*
Disable the Save Applications State feature *)
if my parle_anglais() then
set mon_choix to choose folder with prompt "Choose the folder(s) linked to the application(s) whose Save Applications State feature must be disabled." default location (Saved_Application_State as alias) with multiple selections allowed without invisible
else
set mon_choix to choose folder with prompt "Choisissez les dossiers associés aux applications dont la fonction « Reprise » doit être désactivée." default location (Saved_Application_State as alias) with multiple selections allowed without invisible
end if
repeat with un_dossier in mon_choix
tell application "System Events"
set parasites to every disk item of folder (un_dossier as text)
repeat with un_parasite in parasites
delete un_parasite
end repeat
end tell
tell application "Finder" to set locked of un_dossier to true
end repeat
end if
end run
--=====
on parle_anglais()
return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
end parle_anglais
--=====
--[/SCRIPT]
--{code}