Hallo liebes Forum,
ich bin AppleScipt-Neuling und suche & lese seit einigen Tagen hier im Forum mit.
Nach einigen schnellen Erfolgen, hakt es jetzt leider ein wenig.
Ich möchte die Exif-Informationen aller JPG eines Verzeichnisses auslesen (und diese Bilder später als HTML-Seite mit den EXIFs verknüpfen)
Ich bin auf der Seite des exiftools auf ein AppleScript (get_tags) gestossen das ich nach einigem Basteln zum Laufen bekommen habe.
Ich scheitere jedoch daran, wenn im Verzeichnis eine Bilddatei ist, die ein Leerzeichen im Namen trägt. zB. "Eins Zwei.JPG"
Das Script unterbricht dann zur Laufzeit mit "2" Fehlermeldungen
error "Error : File not Found .../Eins Error : File not Found Zwei.JPG"
Hat jemand hier im Forum eine gute Idee ?
Oder kann mir erklären wo mein Gedankenfehler liegt ?
Im voraus schon einmal vielen Dank
Viele Grüße
Skontomobil
Code # Wähle Verzeichnis # ermittle Dateien im Verzeichnis # lese zu allen JPG die EXIF-Informationen (Funktion get_tags) # PROBLEM - Script kann nicht mit Leerzeichen im Filename umgehen # nächste Schritte : # erstelle eine HTML-DAtei mit den JPG und den EXIF-Informationen # (Aufsteigend nach CreationDate im EXIF, nicht nach File-Datum) on get_tags(a_File, a_list) local the_file, the_cmd, a_tag_name, the_MD, oldTID, the_MDlist, the_MDlist2, an_Item, the_MDrecordList, the_MDrecord, a_TagRec set the_file to POSIX path of a_File set the_cmd to "/usr/local/bin/exiftool -s2 -n " repeat with a_tag_name in a_list set the_cmd to the_cmd & " -" & a_tag_name end repeat set the_cmd to the_cmd & " " & the_file set the_MD to do shell script the_cmd log "the_MD nach EXIF-Lauf : " & return & the_MD --Get each line of exiftool output as an element in list the_MDlist set oldTID to AppleScript's text item delimiters set AppleScript's text item delimiters to return set the_MDlist to every text item of the_MD --get list of lines of output --Build the_MDlist2: a list of sublists, each sublist of the form {"TagName", "TagValue"} set AppleScript's text item delimiters to ": " --should be only 1 occurrence of this per line set the_MDlist2 to {} repeat with an_Item in the_MDlist set end of the_MDlist2 to {text item 1 of an_Item, text item 2 of an_Item} end repeat set AppleScript's text item delimiters to oldTID --restore the default text item delimiters --Transform into the_MDrecordList: a list of records, each a tag name/value pair set the_MDrecordList to {} repeat with an_Item in the_MDlist2 set end of the_MDrecordList to {item 1 of an_Item, item 2 of an_Item} end repeat set the_MDrecord to {} set the_MDrecord to the_MDrecordList return the_MDrecord end get_tags tell application "Finder" #set Arbeitsverzeichnis to (choose folder with prompt "Bitte Verzeichnis wählen das eingelesen werden soll") set Arbeitsverzeichnis to choose folder set allFiles to (every file of (Arbeitsverzeichnis)) end tell repeat with i from 1 to count items of allFiles set SingleFile to (item i of allFiles) as alias set ParameterListe to {"'CreateDate'", "'ImageDescription'", "GPSLatitude", "GPSLongitude", "Model", "Make", "FocalLength", "ExposureTime", "FNumber", "ISO"} set my_Tags to get_tags(SingleFile, ParameterListe) end repeat PS:
Eine Zusatzfrage hab ich direkt noch ...
Kann mir jemand erklären, warum das Script mit
error "„Finder“ hat einen Fehler erhalten: Fortfahren nicht
möglich: get_tags." number -1708
abbricht, wenn ich das "end tell" hinter "end repeat" setze ?