Как редактировать «Отправить получателю» в Windows Xp или Windows 7

1134
Maciej Szpakowski

Я использую клиент Windows Live Mail. Желаемый результат:

  1. Пользователь щелкает правой кнопкой мыши по файлу и выбирает «Отправить»> «Получатель почты» (или другой пользовательский ярлык).
  2. Откроется окно Новое сообщение Windows Live Mail, содержащее:

    Кому: конкретный адрес электронной почты
    Тема: (пусто)
    Тело: (пусто)
    Прикрепленный файл прикреплен

Ближайший я получил это создание ярлыка в папке Send To такой целью: C:\Program Files\Windows Live\Mail\wlmail.exe" /mailurl:mailto:123@live.com.

В результате появляется окно «Новое сообщение» Windows Live Mail, которое содержит:

Кому: 123@live.com "C: \ somefile.txt"
Тема: (пусто)
Тело: (пусто)

Почти верно, за исключением того, что выбранный файл не прикреплен ! Это упоминается только в поле To :. Как я могу прикрепить его, а также заполнить To:поле автоматически?

РЕДАКТИРОВАТЬ: «Обратите внимание, что вы не можете прикрепить файлы из командной строки», это означает, что это по крайней мере очень сложно.

0
WLM установлен в качестве почтовой программы по умолчанию? CharlieRB 9 лет назад 0
Да, когда я нажимаю кнопку отправить в адрес электронной почты получателя, она работает нормально, но в теле есть несколько символов bs, и тема всегда задается как Email: file Maciej Szpakowski 9 лет назад 0

1 ответ на вопрос

0
Anaksunaman

Unfortunately there may be no good way to do this, but below is an AutoHotKey script that mostly gets the job done. An overview of AutoHotKey from Wikipedia is here.

This script was tested on Windows 7 with Windows Live Mail 2012. While most of the beginning portions of the script (up to Run) are generic, the rest is specific and likely will require changes if another gui email program (e.g. Outlook 365, Thunderbird, etc.) is used.

Expectations

The script was written with the following in mind...

  • AutoHotKey is installed on the PC executing the script. If you would like to turn the script into a stand-alone executable, check out ahk2exe.

  • The script expects a single AutoHotKey script command line parameter -- an email address. This allows one script to handle (potentially) different email addresses.

    In order to pass an address, a link for each potential address should be created as follows:

    "C:\Path\To\AutoHotkey\AutoHotkey.exe" "C:\Path\To\Script.ahk" someone@somewhere.com

  • For the sake of uniform action and using command line parameters (which increase script reliability), the script kills then restarts wlmail.exe. So if your are working with Windows Live Mail already, save your work before running it!

  • The script uses the clipboard. Therefore, you should Control+C the item you wish to attach before running the script.

Known Issues

Unfortunately, I'm not a AutoHotKey Ninja so this script may not be perfect. ;-)

However, after a couple days of testing, the script below was reliable at least 99% of the time.

  • It is possible you may experience timing issues occasionally that cause the F10 keystroke in the script not to be recognized by Windows Live Mail.

    This is mostly because Windows Live Mail is lacking in more reliable methods of automation (i.e. no command line attachment, non-standard ribbon interface, and no hot key combo for attaching files).

  • If the "Scheduled Tasks" window appears, this may throw things off as well.

  • If the path from the clipboard isn't valid, you may have to manually terminate the script (see below).

Finally, be aware that if the actions of the script are interrupted (you don't get to a point where Windows Live Mail opens and the item you want is automatically attached), you should look at the Quick Launch area and make sure to shut down that instance of script if necessary before trying again.

AutoHotKey Script to Automate Attachements In Windows Live Mail

Use: Copy an item to the clipboard (Control+C is easiest), then click the link that starts the script (which also should pass the name of the recipient as a command line parameter.)

The script text below should be copy/pasted in its entirety into a standard .txt file and renamed with the .ahk (AutoHotKey script) extension.

; -- 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, ; 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, 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, v Sleep 1000 Send exitapp ; Exit our script 
"Пара дней испытаний"? Ничего себе, завтра я проверю, чтобы убедиться, что это действительно. Раньше не думал об AHK, но, возможно, это единственное решение. Программирование MAPI меня ни к чему не привело :( Maciej Szpakowski 9 лет назад 0
Ну ... пару ленивых дней :-) Но да, наверное, я бы тоже попробовал что-то вроде MAPI, но WLM просто кажется ... неподходящим в этом случае. : - / Anaksunaman 9 лет назад 0
@Maciej Szpakowski Я не уверен, будет ли это соответствовать требованиям, поскольку в вашем сообщении указана Windows Live Mail, но вы можете проверить эти сценарии AHK на основе CDO для отправки по почте, если вы заинтересованы в использовании некоторых материалов, связанных с MAPI. Оба имеют интерфейсы / пути вложения - http://www.autohotkey.com/board/topic/36522-cdo-com-email-delivery/ и http://www.autohotkey.com/board/topic/60813-cdo -почта-Com-доставка-AHK-л / Anaksunaman 9 лет назад 0