[<] Sujet : [AS] Vidage_sécurisé_de_caches_des_navigateurs _internet_Camino,Safari_et_Google_Chrome.
De : Jacques PIOTROWSKI <anonyme@...>
Date : 2010-05-16 15:04:32
Bonjour,
voici une suite un peu plus travaillée de mon premier script sur le
vidage des
caches de différents navigateurs internet:
-- Application : ViderCachesInternet.
-- Langage : AppleScript.
-- Langue : Français.
-- Plate-forme : Apple MAC OS X.
-- But : Vider les caches internet de Camino,Safari et Google
Chrome, en mode sécurisé.
-- Auteur : Jacques Piotrowski, le 05 avril 2010.
-- Licence : GNU/GPL (http://www.gnu.org/licenses/gpl.html).
--
-- Initialiser les constantes
--
set label_Annuler to "Annuler"
set label_Continuer to "OK"
set libelle_delete_Cache_ok to "Camino:Dossier 'Cache' vidé" as string
set libelle_delete_Cache_ko to "Camino:Dossier 'Cache' non vidé" as
string
set libelle_delete_IconCache_ok to "Camino:Dossier 'CacheIcones' vidé"
as string
set libelle_delete_IconCache_ko to "Camino:Dossier 'CacheIcones' non
vidé" as string
set libelle_delete_cookies_sqlite_ok to "Camino:'cookies.sqlite'
supprimé" as string
set libelle_delete_cookies_sqlite_ko to "Camino:'cookies.sqlite' non
supprimé" as string
set libelle_delete_history_dat_ok to "Camino:'history.dat' supprimé"
as string
set libelle_delete_history_dat_ko to "Camino:'history.dat' non
supprimé" as string
set libelle_delete_Cache_chrome_ok to "Chrome:'Cache' vidé" as string
set libelle_delete_Cache_chrome_ko to "Chrome:'Cache' non vidé" as
string
set libelle_delete_MediaCache_chrome_ok to "Chrome:'Media Cache' vidé"
as string
set libelle_delete_MediaCache_chrome_ko to "Chrome:'Media Cache' non
vidé" as string
set libelle_delete_Cache_safari_ok to "Safari:'Cache' vidé" as string
set libelle_delete_Cache_safari_ko to "Safari:'Cache' non vidé" as
string
set libelle_delete_Cachedb_safari_ok to "Safari:'Cache.db' supprimé"
as string
set libelle_delete_Cachedb_safari_ko to "Safari:'Cache.db' non
supprimé" as string
--
-- Récupérer le nom du dossier de l'utilisateur courant
--
tell application "System Events" to set username2 to name of (current
user)
--
-- Initialiser les variables
--
set delete_Cache_ok to false as boolean
set delete_IconCache_ok to false as boolean
set delete_cookies_sqlite_ok to false as boolean
set delete_history_dat_ok to false as boolean
set delete_Cache_chrome_ok to false as boolean
set delete_MediaCache_chrome_ok to false as boolean
set delete_Cache_safari_ok to false as boolean
set delete_Cachedb_safari_ok to false as boolean
set liste_actions_ok to {}
--
-- Demande de confirmation
--
display dialog "Vider les caches internet de Camino, Safari et Google
Chrome, en mode sécurisé ?" buttons {label_Continuer, label_Annuler} ¬
default button 1 ¬
with icon caution
copy the result as list to {the button_pressed}
if the button_pressed is label_Annuler then
tell me to quit
end if
--
-- Vidage des différents caches et fichiers
--
tell application "Finder"
try
delete every file of folder "Cache" of folder "Camino" of folder
"Caches" of folder "Library" of folder username2 of folder "Users" of
startup disk
set delete_Cache_ok to true as boolean
end try
try
delete every file of folder "IconCache" of folder "Camino" of folder
"Caches" of folder "Library" of folder username2 of folder "Users" of
startup disk
set delete_IconCache_ok to true as boolean
end try
try
delete file "cookies.sqlite" of folder "Camino" of folder
"Application Support" of folder "Library" of folder username2 of
folder "Users" of startup disk
set delete_cookies_sqlite_ok to true as boolean
end try
try
delete file "history.dat" of folder "Camino" of folder "Application
Support" of folder "Library" of folder username2 of folder "Users" of
startup disk
set delete_history_dat_ok to true as boolean
end try
try
delete every file of folder "Cache" of folder "Default" of folder
"Chrome" of folder "Google" of folder "Caches" of folder "Library" of
folder username2 of folder "Users" of startup disk
set delete_Cache_chrome_ok to true as boolean
end try
try
delete every file of folder "Media Cache" of folder "Default" of
folder "Chrome" of folder "Google" of folder "Caches" of folder
"Library" of folder username2 of folder "Users" of startup disk
set delete_MediaCache_chrome_ok to true as boolean
end try
try
delete file "Cache.db" of folder "com.apple.safari" of folder
"Caches" of folder "Library" of folder username2 of folder "Users" of
startup disk
set delete_Cachedb_safari_ok to true as boolean
end try
try
delete every file of folder "Webpage Previews" of folder
"com.apple.safari" of folder "Caches" of folder "Library" of folder
username2 of folder "Users" of startup disk
set delete_Cache_safari_ok to true as boolean
end try
end tell
--
-- Bilan des actions
--
if delete_Cache_ok then
set liste_actions_ok to liste_actions_ok & libelle_delete_Cache_ok &
return
else
set liste_actions_ok to liste_actions_ok & libelle_delete_Cache_ko &
return
end if
if delete_IconCache_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_IconCache_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_IconCache_ko & return
end if
if delete_cookies_sqlite_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_cookies_sqlite_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_cookies_sqlite_ko & return
end if
if delete_history_dat_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_history_dat_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_history_dat_ko & return
end if
if delete_Cache_chrome_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_Cache_chrome_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_Cache_chrome_ko & return
end if
if delete_MediaCache_chrome_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_MediaCache_chrome_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_MediaCache_chrome_ko & return
end if
if delete_Cachedb_safari_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_Cachedb_safari_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_Cachedb_safari_ko & return
end if
if delete_Cache_safari_ok then
set liste_actions_ok to liste_actions_ok &
libelle_delete_Cache_safari_ok & return
else
set liste_actions_ok to liste_actions_ok &
libelle_delete_Cache_safari_ko & return
end if
set resultat_actions to (liste_actions_ok as string)
display dialog resultat_actions ¬
buttons {label_Continuer, label_Annuler} ¬
default button 1 ¬
with icon note
copy the result as list to {the button_pressed}
if the button_pressed is label_Annuler then
tell me to quit
end if
--
-- Vidage sécurisé de la corbeille
--
with timeout of 600 seconds
tell application "Finder" to empty trash with security
end timeout
_______________________________________________
Applescript_fr mailing list
anonyme@...
http://listes.patpro.net/mailman/listinfo/applescript_fr
Sujet : Re: [AS] Vidage_sécurisé_de_caches_des_navigateurs _internet_Camino,Safari_et_Google_Chrome.
De : MADERT Pascal <anonyme@...>
Date : 2010-05-16 16:49:43
Sujet : Re: [AS] Vidage_sécurisé_de_caches_des_navigateur s_internet_Camino,Safari_et_Google_Chrome.
De : Yvan KOENIG <anonyme@...>
Date : 2010-05-16 17:32:01