I have a button in a view that will send a print command and use a PDF printer driver to generate a PDF file. All works well until I add a Lotus Script line to it. (Msgbox) Then nothing works. If I remove the Msgbox command, the Keybd_events work perfectly. If I remove the Keybd_Events the Msgbox works perfectly. Can’t get them to work together. I even separated them into two different agents and had a third call them. Again, no luck… Any suggestions? Code provided below…
Thanks!
Sub press
keybd_event 18,0 ,0,0 'alt down
keybd_event 70,0 ,0,0 ' F down
keybd_event 70,0 ,2,0 ' F up
keybd_event 80,0 ,0,0 ' P Down
keybd_event 80,0 ,2,0 ' P Up
keybd_event 18,0 ,2,0 ' alt up
keybd_event 78,0 ,0,0 ' N Down
keybd_event 78,0 ,2,0 ' N Up
keybd_event 88,0 ,0,0 ' x down
keybd_event 88,0 ,2,0 ' x up
keybd_event 13,0 ,0,0 ' enter down
keybd_event 13,0 ,2,0 ' enter down
Msgbox "PDF Created"
Subject: RE: Keybd_event and Script
When you call these keyboard events, you’re queueing them for the next time the system is able to process input. Nothing happens with them while you’re buzzing along through your script. But then you call Msgbox, and you’ve paused for input (waiting for the user to press OK). So ok, let’s see what keyboard events are in the queue. Wow, a bunch of them!
If you skip the Alt F P and use NotesUIView.Print to open the print dialog (after queueing keyboard events), then the print dialog will consume the keyboard events instead of the messagebox.
However, I have to say I’m not thrilled about your code from a maintainability standpoint. What happens if one user has a different set of printers available?
Subject: Keybd_event and Script - GOT IT!
Ahhhhh…
I reversed the order. I put keyboard events first then called uiview.print.
Worked like a charm!
Thanks again Andre!
Subject: RE: Keybd_event and Script
Thanks Andre. If I change the MSgbox to Print “PDF created” it still doesn’t work so waiting for user input isn’t the issue. I’m not thrilled about this either but have to do it… All PC’s in our organization are identical so they all have the PDF driver with the same name and users have no rights to change.