How to select printer and print with AutoHotKey

丶灬走出姿态 提交于 2019-12-11 05:09:29

问题


I am trying to automate export of Lotus Notes emails to Microsoft XPS documents so that I'll be able to search through them.

Now I would like to automate the export by using AutoHotKey to print and select 'Microsoft XPS document' in the printer name list.

I have the following script:

; F2 is my chosen HotKey that will trigger the script, starting with a CTRL-P
*F2::^p

; type 'm' to choose 'Microsoft XPS Document Printer'
Send m
{enter}

which opens the print view window, but does not select the printer, although manually typing 'm' works. I tried a sleep but did not work either.


回答1:


First of all, your second command is never executed. When you place a command at the same line as your initiating code. Even when the second command was executed it could be too fast. try this:

F2:: ; Use the F2 key (I would use F1 as I never use the help key)
Send, ^p ; Send Control P to print
Sleep, 1000 ; wait 1 second (or less) for print dialoguebox
Send, m ; Select printer type
Sleep, 100 ; Wait 0.1 sec. before pressing enter
Send, {Enter} ; Press enter
Return ; End this command

Regards,

Robert Ilbrink



来源:https://stackoverflow.com/questions/8679870/how-to-select-printer-and-print-with-autohotkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!