各アドレスに特定の添付ファイルを含むいくつかのメールを送信しようとしています。すべてのアドレスには、添付ファイル用の独自のサブフォルダーがあります。「添付ファイルの部分をつかむ」が機能せず、ハンドラーが正しく設定されているかどうかわかりません。サブフォルダーをハンドラー内のメールに渡すか、そのままにしておく必要があります。これは私の最初の長いスクリプトなので、あまり厳しくしないでください ;-)
私は実用的な解決策に近づいていると思っていますが、まだ機能していません。これまでの私のスクリプトは次のとおりです。
`  with timeout of 600 seconds
-- Liste: Alle Empfänger  
tell application "Contacts"
    set emailList to {}
    set testPersons to every person of group "Test"
    repeat with thisTestPerson in testPersons
        set end of emailList to (value of email of thisTestPerson) as string
    end repeat
end tell
-- Liste fuer die Übergabe alphabetisch sortieren 
set the_list to emailList
set otid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10} -- always a linefeed 
set list_string to (the_list as string)
set new_string to do shell script "echo " & quoted form of list_string & " | sort -f"
set new_list to (paragraphs of new_string)
set AppleScript's text item delimiters to otid
-- Liste: Alle Subfolder 
tell application "Finder"
    set mainfolder to choose folder "select a folder"
    set folderList to {}
    set myFolders to every folder of mainfolder
    repeat with attachFolder from 1 to (count of myFolders)
        set end of folderList to attachFolder as string
    end repeat
end tell
-- Sicherheits-Check
set count1 to count of myFolders
set count2 to count of new_list
if count1 is not equal to count2 then
    display dialog "Houston, we have a problem:" & return & "Die beiden Listen sind nicht gleich lang..." buttons {"ok"} with icon 2
    return
end if
 end timeout
 --handler processfolder(myFiles)
 on processfolder(myFiles)
tell application "Mail"
    activate
    set theAddress to (item i of emailList)
    set theMex to (make new outgoing message at end of outgoing messages with   properties {visible:true, subject:"Subjectheader",   content:"email body"})
    tell content of theMex
        make new attachment with properties {file name:FileList} at after last paragraph
    end tell
    tell theMex
        make new to recipient at end of to recipients with properties {address:theAddress}
    end tell
    send theMex
end tell
end processfolder
-- grab attachments and send mail   
tell application "Finder"
repeat with myFolder from 1 to (count of folderList)
    set FileList to {}
    set myFiles to entire contents of myFolder
    repeat with thisFile in myFiles
        set end of FileList to thisFile as string
    end repeat
    my processfolder(myFiles)
end repeat
 end tell
display dialog (count1 as string) & " Nachrichten verschickt."
end`
ハンドラーは問題なく動作するはずです。サブフォルダ リストとアドレス リストの一致は依然として問題のようです。「添付ファイルを取得してメールを送信する」という繰り返しループで問題が解決するかどうかはわかりません。これは繰り返しループの扱いが難しく、私はまだ苦労しています。私がまだ間違っていることについての簡単な考えはありますか?
役に立ってくれてありがとう!本当に感謝しています!マルコ