Hallo Little Pixel.
Wenn Das nur so überlegt war, war es ein Volltreffer.
Danke für die Beschreibung der einzelnen Zeilen, hat sehr geholfen zu verstehen was ich da schreibe.
Script habe fertig!
Am Anfang konnte ich keine Ordneraktion Anhängen, also habe ich an den Rechten gebogen. Dann hat mich die repeat Schleife um den Verstand gebracht.
Mittlerweile ist mein Verstand wieder da.
Erschrecke nicht wegen der Parameter Tabele.
Mache dass immer so, weil die komplette Funktion drunter sehr flexibel ist, und so sehr leicht in andere Projekte zu übernehmen. Erweiterung der Parameter Liste ist daher auch kein Problem. Werde das Script Duplizieren und an andere zu Überwachenden Ordner anpassen.
Sprachausgabe:
Geil wenn dein Script dich über alles informiert. Meldung am Fenster lenkt nur ab. Das Schimpen werde ich meinem Micky auch noch beibringen, dass aber später.
Bin Offen für Verbesserungsvorschläge.
Mein Konstrukt:
on adding folder items to this_folder after receiving added_items
tell application "Finder"
-- Parametrierung
set PFAD to "Pfad des Überwachten Ordners"
-- Sprachausgabe
set MSGA to "New"
set MSGB to "Files"
set SPK to "1" -- Sprachausgabe (1-An, Anreder Wert-Aus) Bei Aus ist Beep an.
set WHO to "Vicky"
set MESS to ""
set theFolder to alias PFAD
set COUNTER to {1, 2, 3, 4, 5, 6, 7, 8}
set ZIEL1 to "Archive Osla"
set MSG1 to "Archive"
set EXT1 to ".rar"
set ZIEL2 to "Archive"
set MSG2 to "Archive"
set EXT2 to ".zip"
set ZIEL3 to "Archive"
set MSG3 to "Archive"
set EXT3 to ".ace"
set ZIEL4 to "JPGs"
set MSG4 to "Picture"
set EXT4 to ".jpg"
set ZIEL5 to "AVIs"
set MSG5 to "Video"
set EXT5 to ".avi"
set ZIEL6 to "MPGs"
set MSG6 to "Video"
set EXT6 to ".mpg"
set ZIEL7 to "MPGs"
set MSG7 to "Video"
set EXT7 to ".mpeg"
set ZIEL8 to "MUSIK"
set MSG8 to "Music"
set EXT8 to ".mp3"
repeat with CNT in COUNTER
set EXLIST to {EXT1, EXT2, EXT3, EXT4, EXT5, EXT6, EXT7, EXT8}
set EXTENTION to item CNT of EXLIST
set ZILIST to {ZIEL1, ZIEL2, ZIEL3, ZIEL4, ZIEL5, ZIEL6, ZIEL7, ZIEL8}
set ZIEL to item CNT of ZILIST
set NACHRICHT to {MSG1, MSG2, MSG3, MSG4, MSG5, MSG6, MSG7, MSG8}
set NALIST to item CNT of NACHRICHT
if (not (exists (items of theFolder whose name contains EXTENTION))) then
set CNT to (CNT + 1)
else
set suchErgebnis to {items of theFolder whose name contains EXTENTION}
if (not (exists folder ZIEL in folder PFAD)) then
make new folder at (PFAD) with properties {name:ZIEL}
else
-- Dient Der Überprüfung:
--display dialog "Ext: " & EXTENTION & " ZIEL:" & ZIEL & " Nachr:" & NALIST & " Count:" & CNT & " - ((" & suchErgebnis & ")) " giving up after 4
set MESS to NALIST
move suchErgebnis to PFAD & ZIEL
NEUEDATEN(SPK, WHO, MESS, MSGA, MSGB) of me
end if
end if
end repeat
end tell
end adding folder items to
on NEUEDATEN(SPK, WHO, MESS, MSGA, MSGB)
if SPK is "1" then
say MSGA & MESS & MSGB using WHO
else
beep 1
end if
end NEUEDATEN