1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| on Change_Nom(les_Fichiers) -- routine de changement de fichiers
repeat with un_Fichier in les_Fichiers
tell application "Finder" to display dialog "Ok pour 1"
-- Masquage extension --
tell application "Finder"
set extension hidden of the un_Fichier to true
tell application "Finder" to display dialog "Extension Ok"
end tell
-- determine nouveau nom
set ancienNomFichier to name of un_Fichier
tell application "Finder" to display dialog "Ok pour 2"
-- Suppression éléments nom --
set NouveauNom to Remplace(ancienNomFichier, {".1024x768", ".1024x600", ".toto"}, "")
tell application "Finder" to display dialog "Ok pour 3"
-- Remplacement 1 --
set NouveauNom to Remplace(NouveauNom, {".V", ".Version ", ".V."}, "- V")
tell application "Finder" to display dialog "Ok pour 4"
-- Remplacement 2 --
set NouveauNom to Remplace(NouveauNom, {".A finir", ".Non achevé", ".Terminé"}, "- FINI")
tell application "Finder" to display dialog "Ok pour 5, nouveau nom=" & NouveauNom
tell application "System Events" to set name of un_Fichier to NouveauNom
end repeat
tell application "Finder" to display dialog "Ok pour 6"
end Change_Nom
on Remplace(Nom, Liste, Nouveau) -- remplace dans le Nom, les élements de la Liste par Nouveau
set {ancienTID, my text item delimiters} to {my text item delimiters, Liste}
set TempNom to text items of Nom
set my text item delimiters to Nouveau
set Nom to TempNom as text
set my text item delimiters to ancienTID
return Nom
end Remplace |
Partager