Étiquette : osx

  • Renommer les images d’un dossier avec ses données exifs

    Voici un AppleScript qui peut être utilisé dans Automator pour renommer tous les fichiers d’un dossier de photos en utilisant les données EXIF sélectionnées à partir d’une liste déroulante:

    -- Set the property to the chosen EXIF data
    set theProperty to choose from list {"Date Time Original", "Make", "Model"} with prompt "Choose the EXIF data to use for renaming:"
    
    -- Check if a property was chosen
    if theProperty is not false then
        -- Set the property to the first item in the list (since choose from list returns a list)
        set theProperty to item 1 of theProperty
        
        -- Set the folder path
        set folderPath to (choose folder with prompt "Choose the folder containing the photos:") as text
        
        -- Get the list of files in the folder
        tell application "Finder"
            set fileList to every file of folder folderPath
        end tell
        
        -- Loop through each file in the list
        repeat with aFile in fileList
            -- Get the file path
            set filePath to aFile as text
            
            -- Get the EXIF data for the chosen property
            set exifData to do shell script "mdls -raw -name kMDItem" & theProperty & " " & quoted form of POSIX path of filePath
            
            -- Check if EXIF data was found
            if exifData is not "" then
                -- Rename the file using the EXIF data
                tell application "Finder"
                    set name of aFile to exifData & "." & name extension of aFile
                end tell
            end if
        end repeat
    end if
    
    

    Ce script vous permet de choisir les données EXIF à utiliser pour renommer les fichiers à partir d’une liste déroulante. Vous pouvez ajouter ou supprimer des options de la liste en modifiant la première ligne du script. Est-ce que cela répond à vos besoins?

  • Automator Ouvrir dans le Terminal

    Script utilisant le finder pour obtenir le chemin d’accès POSIX du dossier actuellement ouvert dans la fenêtre active. Il utilise ensuite l’application Terminal pour ouvrir une nouvelle fenêtre de terminal et exécuter la commande cd pour se déplacer vers ce chemin d’accès.

    tell application "Finder"
    	set currentPath to quoted form of (POSIX path of (target of front window as alias))
    end tell
    
    tell application "Terminal"
    	do script "cd " & currentPath
    	activate
    end tell
    
  • AUTOMATOR nouveau fichier

    on run {input, parameters}
        tell application "Finder"
            set currentFolder to container of item 1 of input as alias
            set newFileName to text returned of (display dialog "Nom du nouveau fichier :" default answer "" buttons {"Annuler", "Créer"} default button 2)
            if length of newFileName > 0 then
                set newFile to make new file at currentFolder with properties {name:newFileName}
            end if
        end tell
        return input
    end run