LoginSignup
1
2

More than 5 years have passed since last update.

Outlook for Macに渡すプリントプラグイン(特にeFax用)

Last updated at Posted at 2018-11-09

OSXの標準印刷ダイアログには「"メール"で送信」という機能があり,これを使うと,PDFが添付されたメールが作成されます。
しかし,筆者はOutlook for Macを常用しており,標準の「"メール"で送信」は使えません。
そこで,Automatorを使って,Outlook版「"メール"で送信」を行う「プリントプラグイン」を作りました。

といいつつ,筆者にとって「"メール"で送信」が必要なのは,主にPDFの一部ページをeFaxで送信する場合です。たとえば,複数ページのPDFに対し,先頭ページに受領印(スタンプ)を押して先頭ページのみ返信するといった使い方です。
eFaxは,メールにPDFを添付してFAXを送受信するインターネットFAXサービスで,FAXを送信する場合は「81«FAX番号»@efaxsend.com」というアドレス(ただし«FAX番号»は冒頭の0を除外)にメールを送信することになります。

そこで,単に添付ファイルとして渡すだけではなく,ダイアログでFAX番号の入力を求め,eFax送信用のアドレスをto欄に記載した状態で,新規メールを生成するようにしました。

要件定義

  • Outlook for Mac の操作にはAppleScriptを使う。
    • 現バージョンには専用のAutomatorアクションが無いため。
  • メールの下書き作成にとどめ,送信は手動で行うことにする。
  • 送信先のFAX番号の入力をダイアログで求め,送信先メールアドレスを生成する。
    • 桁数だけ見て,入力チェック等は行わない。(作成者の怠慢)
    • 番号を入力しない場合は,to空欄のメール下書きを生成する。

内容

「AppleScriptを実行」アクションのみでできています。

アクション「AppleScriptを実行」
on run {input, parameters}
    set InputPDFs to input
    set FAXnumber to text returned of (display dialog "FAX番号(ハイフンなし)" default answer "")
    tell application "Microsoft Outlook"
        set newMessage to make new outgoing message
        if length of FAXnumber > 9 then
            set efaxAddress to {email address:{name:"FAX" & FAXnumber, address:"81" & (text 2 thru -1 of FAXnumber) & "@efaxsend.com"}}
            make new to recipient at newMessage with properties {efaxAddress}
        end if
        tell newMessage
            repeat with aPDF in InputPDFs
                make new attachment with properties {file:aPDF}
            end repeat
        end tell
        open newMessage
        get newMessage
    end tell
    return input
end run

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2