我使用的客戶端是Windows Live Mail。期望的結果:
使用者右鍵點選檔案並選擇「傳送至->郵件收件者」(或其他自訂建立的捷徑)。
Windows Live Mail 新訊息視窗彈出,其中包含:
收件者:具體電子郵件地址
主題:(空白)
正文:(空白)
已附加點擊的文件
我得到的最接近的是在“發送到”資料夾中創建具有以下目標的快捷方式:。C:\Program Files\Windows Live\Mail\wlmail.exe" /mailurl:mailto:[email protected]
結果是彈出 Windows Live Mail 新郵件窗口,其中包含:
到:[電子郵件受保護]"C:\somefile.txt"
主題:(空)
正文:(空)
幾乎正確,除了,所選文件未附加!僅在「收件者:」欄位中提及。如何附加它,同時To:
自動填寫欄位?
編輯:「請注意,您無法從命令列附加文件」這意味著它至少非常困難。
答案1
不幸的是,可能沒有好的方法來做到這一點,但下面是一個自動熱鍵主要完成工作的腳本。維基百科上的 AutoHotkey 概述如下。
該腳本在 Windows 7 和 Windows Live Mail 2012 上進行了測試Run
。 Thunderbird、等)被使用。
期望
編寫腳本時考慮到以下內容...
AutoHotkey 安裝在執行腳本的 PC 上。如果您想將腳本轉換為獨立的可執行文件,請查看ahk2exe。
該腳本需要一個AutoHotkey 腳本命令列參數— 電子郵件地址。這允許一個腳本處理(可能)不同的電子郵件地址。
為了傳遞地址,應為每個潛在地址建立一個鏈接,如下所示:
"C:\Path\To\AutoHotkey\AutoHotkey.exe" "C:\Path\To\Script.ahk" [email protected]
為了統一操作並使用命令列參數(這會增加腳本可靠性),腳本會殺死然後重新啟動
wlmail.exe
。因此,如果您已經在使用 Windows Live Mail,請在運行之前儲存您的工作!該腳本使用剪貼簿。因此,您應該在運行腳本之前Ctrl添加您想要附加的項目。C
已知的問題
不幸的是,我不是 AutoHotkey Ninja,所以這個腳本可能並不完美。 ;-)
然而,經過幾天的測試,下面的腳本至少在 99% 的情況下都是可靠的。
- 您可能偶爾會遇到計時問題,導致F10 按鍵Windows Live Mail 無法辨識腳本中的內容。
這主要是因為 Windows Live Mail 缺乏更可靠的自動化方法(即沒有命令列附件、非標準功能區介面以及沒有用於附加文件的熱鍵組合)。
如果出現「計劃任務」窗口,這也可能會導致事情失敗。
如果剪貼簿中的路徑無效,您可能必須手動終止腳本(請參閱下文)。
最後,請注意,如果腳本的操作中斷(您不會到達 Windows Live Mail 開啟的點)並且您想要的項目會自動附加),您應該查看“快速啟動”區域,並確保在重試之前關閉該腳本實例(如有必要)。
用於在 Windows Live Mail 中自動新增附件的 AutoHotkey 腳本
使用
將項目複製到剪貼簿(Ctrl+C最簡單),然後按一下啟動腳本的連結(該腳本也應將收件人的姓名作為命令列參數傳遞。)
下面的腳本文字應完整複製/貼上到標準檔案中.txt
,並使用.ahk
(AutoHotkey 腳本)副檔名重命名。
; -- Functions & Variables --
; A custom to check if a given processes is active
ProcessExist(Name){
Process,Exist,%Name%
return Errorlevel
}
; -- Begin Script --
; Command line parameter debug box.
;MsgBox, The number of command line parameters is %0%. `n`n The email recipient is %1%
; Check for command line parameters - terminate if we have anything but one.
If 0 <> 1
{
MsgBox, You have not specified a valid email address. Script terminating.
exitapp ; Exit our script
}
; If our clipboard is empty, show a warning
If clipboard =
{
MsgBox, 4, , Please copy your attachment to the clipboard.`n`nContinue?
IfMsgBox, No, exitapp ; Exit our script
}
ClipWait ; Wait for the clipboard to contain text.
;Display the last item copied to the clipboard to confirm this is the item we want.
Loop, parse, clipboard, `n, `r
{
MsgBox, 4, , File number %A_Index% for attachement is located at %A_LoopField%.`n`nEmail recipient is %1%.`n`nContinue?
IfMsgBox, No, exitapp ; Quit the AutoHotkey script if the user says no.
}
; Start with a clean Windows Live Mail instance.
; wlmail.exe may active as a process so we make sure to kill it.
If ProcessExist("wlmail.exe")
Process, Close, wlmail.exe
Sleep 100 ; Make sure the process has time to terminate
; Start a fresh wlmail.exe process to send a new email.
; /mailurl:mailto: is part of the wlmail.exe command line options.
Run, "C:\Program Files (x86)\Windows Live\Mail\wlmail.exe" /mailurl:mailto:%1%
; Make sure our New Message window is active
WinWait, New Message,
IfWinNotActive, New Message, , WinActivate, New Message,
WinWaitActive, New Message,
; If the script is going to fail, it will be between the TAB TAB F10 4 strokes.
; Double TAB brings us to the body of the message. Otherwise, the address field is the first active
; item and F10 brings up a different menu.
Send, {TAB} {TAB}
; Show the attachment dialog via pressing F10 then 4.
; Increase the Sleep value for better key stroke reliability -- 5000+ recommended.
; Otherwise, Windows Live Mail seems to "miss" the F10 stroke.
Sleep 5000
Send, {F10}
Send, 4
; Make sure our Open file dialog is active
WinWait, Open,
IfWinNotActive, Open, , WinActivate, Open,
WinWaitActive, Open,
; Copy our file path from the clipboard and open it
Send, {CTRLDOWN}v{CTRLUP}
Sleep 1000
Send {TAB}{TAB}{Enter}
exitapp ; Exit our script