-1

10.8では、コンマ区切りのテキストファイルを読み取り、値を使用して新しいメールメッセージを作成し、NSstringパス名を使用してxx.pdfファイルをファイルに添付するMy Applescript(10.4から10.6を実行して開発)は、引き続きメールを送信しますが、添付ファイルは含まれません。問題の調査から、10.8のセキュリティ強化により、メールアプリとアップルスクリプトアプリが「サンドボックス化」され、パス名がファイルへの有効で無難なリンクとして機能しなくなったことがわかりました。NSstring "file name:"をNSURL形式のファイル名に置き換える必要があると主張するいくつかの例を見つけましたが、コードはapplescriptのようには見えず、applescriptエディターでコンパイルされません。ファイルを新しいファイルに添付するapplescriptの例はありますか?applescriptで生成された電子メールメッセージ?私は何日もこの問題を解決しようとして成功しませんでした。私もAppleサポートラインに電話したが、彼らはApplescript関連の問題をもうサポートしないと言った。

テキストファイルから渡す変数の名前は「theAttachment1」です。私が機能させようとしている行は次のとおりです。

"最後の段落の後にプロパティ{filename:theAttachment1}を使用して新しい添付ファイルを作成します

繰り返しますが、10.4から10.6では正常に動作しますが、10.8では動作しません。

4

1 に答える 1

0

これは10.8で動作します

   set theAttachment1 to POSIX file "/Users/USERNAME/Desktop/Desktop--IMAGE/scooter-6.jpg"

tell application "Mail"
    set newMessage to make new outgoing message with properties {subject:"subject", content:"the_content" & return & return}
    tell newMessage

        set visible to false
        set sender to "myaddress@btinternet.com"
        make new to recipient at end of to recipients with properties {address:"someAddress@btinternet.com"}
        make new attachment with properties {file name:theAttachment1} at after the last paragraph

        (* change save to send to send*)
        save --<<<<---------------- change save to send to send
        (* change save to send to send*)
    end tell
end tell

パスは、Unix パス: "/Users/USERNAME/Desktop/Desktop--IMAGE/scooter-6.jpg" または Posix ファイル パス: "Macintosh HD:Users:USERNAME:Desktop:Desktop--IMAGE:scooter " のいずれかです。 -6.jpg"

このスクリプトでは、パスを Unix パスから Posix ファイル パスに変換しました。

于 2012-12-31T00:27:59.097 に答える