Hallo Willem,
ein Ordneraktionsskript muss als normales, kompiliertes Script gesichert sein (also nicht als Application) und einen Handler enthalten, welcher eine typische Ordneraktion in der 'on'-Zeile aufweist, z.B.
Innerhalb dieses Handlers können Aufrufe an weitere Handler stehen. Man muss dabei nur beachten, dass die in beiden verwendeten Variablen bekannt sind. Entweder als 'global' deklariert oder als Parameter in den Klammern weitergereicht.
Beim zuletzt geposteten Droplet muss demnach nur die erste und die letzte Zeile des 'on open'-Handlers geändert werden, damit der Code als Ordneraktions-Script eingesetzt werden kann. Den Run-Handler brauchen wir nicht mehr:
---
on adding folder items to thisFolder after receiving fileList
set AppleScript's text item delimiters to {":"}
repeat with aFile in fileList
set filePath to aFile as string
if filePath ends with ":" then
else
set fileName to text item -1 of filePath
if fileName starts with "bas" then
try
tell application "Finder" to move file aFile to folder "Macintosh HD:Jobs:Dateien_sortieren:Bildererheft" with replacing
end try
else if fileName starts with "ba" then
try
tell application "Finder" to move file aFile to folder "Macintosh HD:Jobs:Dateien_sortieren:Bilder:Backen" with replacing
end try
else if fileName starts with "b" then
try
tell application "Finder" to move file aFile to folder "Macintosh HD:Jobs:Dateien_sortieren:Bilder:Baden" with replacing
end try
else if fileName starts with "ko" then
try
tell application "Finder" to move file aFile to folder "Macintosh HD:Jobs:Dateien_sortieren:Bilder:Kochen" with replacing
end try
end if
end if
end repeat
set AppleScript's text item delimiters to {""}
end adding folder items to
---
Hans Haesler <hsa@ringier.ch>