[?]   dans   mode   trier par   

[<] Sujet : [AS] Ajouter_un_pr_éfixe_à_une_liste_de_fichie rs
De : PJ <anonyme@...>
Date : 2008-02-28 15:50:40

on open liste_des_fichiers
   --
   -- Initialiser les constantes
    --
   set label_Annuler to "Annuler"
   set label_Continuer to "Continuer"
   set label_Reprendre to "Reprendre"
   --
   -- Initialiser les variables de travail
    --
   set racine_ok to false as boolean
   
   tell application "Finder"
       set nb_fichiers to the count items in liste_des_fichiers
   end tell
    --
   -- Saisir un préfixe pour renommer l'ensemble des fichiers
    --
   set message_utilisateur to "Entrez un préfixe qui sera ajouté au nom des
fichiers sélectionnés"
   repeat
        set reponse_utilisateur to display dialog message_utilisateur ¬
           buttons {label_Continuer, label_Annuler} default button 1 ¬
           with icon note default answer ""
       set racine_saisie to text returned of reponse_utilisateur
       set bouton_choisi to button returned of reponse_utilisateur
       if length of racine_saisie > 0 then
            if bouton_choisi = label_Continuer then
                set racine_ok to true
               exit repeat -- Saisie du préfixe
            end if
        else
            if bouton_choisi = label_Continuer then
                set message_utilisateur to "Aucune information saisie !"
           end if
        end if
    end repeat -- Saisie du préfixe
    --
   -- Renommer les fichiers sélectionnés
    --
   tell application "Finder"
       repeat with un_fichier in liste_des_fichiers
           get the info for the un_fichier
           set useMe to the result
           get the name of useMe
           set ancien_nom to the result
           -- display dialog ancien_nom
            set nouveau_nom to racine_saisie & ancien_nom
           -- display dialog nouveau_nom
            set the name of un_fichier to nouveau_nom
       end repeat
    end tell
end open 
_______________________________________________
Applescript_fr mailing list
anonyme@...
http://listes.patpro.net/mailman/listinfo/applescript_fr

Apple, AppleScript, AppleScript Studio, AppleTalk, AppleWorks, ColorSync, Finder, HyperCard, iBook, iLife, iMac, iWork, Keynote, Mac, Macintosh, Mac OS, Pages, Panther, PowerBook, Power Mac, Power Macintosh, QuickTime, Safari, Tiger, Xcode sont des marques déposées par Apple Computer, Inc., enregistrées aux Etats-Unis et dans les autres pays. Liste officielle