Eh bien, j'ai réussi à trouver quelque chose (lire : dirty hack) qui accomplit ce que je veux. J'ai utilisé un AppleScript et un script d'interface utilisateur par le biais de Sikuli . Il peut et doit être fortement amélioré, par exemple, avec une meilleure vérification des erreurs et une meilleure tolérance aux pannes. J'ai dû le garder pendant tout le processus parce que tous les quelques dizaines de fichiers, il s'étouffait sur quelque chose. Cela dit, il a servi mes objectifs et a atteint mon but.
global theCount
set theCount to 0 as number
tell application "Finder"
set theFolder to choose folder with prompt "Select a directory:"
display dialog "This script will open each QuickTime movie file contained within this folder and its subfolders in QuickTime Player 7, and change the Author attribute to an Artist attribute using the Sikuli IDE. Proceed?"
my processFiles(theFolder)
display dialog (theCount as string) & " files processed."
end tell
on processFiles(theFolder)
tell application "System Events"
set theItems to get the name of every disk item of theFolder
end tell
set theFolder to theFolder as string --do this to concatenate with item name in loop
repeat with i from 1 to length of theItems --this is the loop that works on each file in the current folder
set theItem to item i of theItems
set theItem to (theFolder & theItem) as alias --get a file object
set itemInfo to info for theItem --get the file's info
if visible of itemInfo is true then --only work on invisibles
if folder of itemInfo is false then --and check for folders first or next line will fail
if type identifier of itemInfo is "com.apple.quicktime-movie" then
try --makes this more fault-tolerant
tell application "QuickTime Player 7"
open theItem
end tell
set theCount to theCount + 1
do shell script "java -jar /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar /Users/username/Desktop/flip\\ to\\ artist\\ source.sikuli" --Sikuli has a better command line interface, but it wasn't working on the current build. This is connecting directly to its java executable, and is REALLY slow as a result.
end try
end if
else if folder of itemInfo is true then
do shell script "touch \"" & POSIX path of theItem & "\"" --do this to track the progress of the script based on folder modification date
my processFiles(theItem) --operate recursively until all files are processed
end if
end if
end repeat
end processFiles
Le Sikuli script est essentiellement :
switchApp("QuickTime Player 7")
keyDown(Key.CMD)
type("j")
keyUp(Key.CMD)
click([Author annotation tag])
click([Artist option])
keyDown(Key.CMD)
type("s")
keyUp(Key.CMD)
keyDown(Key.CMD)
type("w")
keyUp(Key.CMD)
keyDown(Key.CMD)
type("w")
keyUp(Key.CMD)
waitVanish([a QuickTime window])
Je ne suis pas un développeur Sikuli expérimenté, mais il est presque certain que les pressions sur les touches doivent être intégrées dans l'AppleScript en tant qu'actions de l'interface utilisateur. Cette partie n'est pas difficile. C'est le fait de cliquer sur les choix qui est difficile. L'AppleScript pourrait également vérifier l'attribut Auteur ; ces éléments sont documentés dans le dictionnaire AppleScript, mais la propriété est en lecture seule.