问题
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