LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

keybd_event for dos application

Strange. The example I put together using AutoIt works for me every time. The name of the file gets entered into the text box in the application. This shouldn't be necessary, but ... did you try rebooting the computer? (It's Windows.)

I don't have time to look at the keybd_event method right now. It'll have to wait until this afternoon. Sorry. If someone else wanders by perhaps they may have a chance to look at it before then.
0 Kudos
Message 11 of 16
(908 Views)

There is no actual error code. What happens is BBLIST is executed (no typing occurs) and the vi runs continuously. The stop button does not work (kind of like an infinite loop) and I receive a Resetting VI message. I have to end task to stop the resetting. I tried a restart. I will reinstall and restart.

0 Kudos
Message 12 of 16
(906 Views)
It sounds like the VI is waiting at the WinWaitActive node. That node waits until the specified window gets displayed. On my system the window name is "C:\BBLIST.EXE". Is it different on yours? You can try setting the nTimoutInput to, say, 5 so it times out after 5 seconds and continues on. An alternative is to set the WinTitleMatchMode property to 2 (Match any substring in the title) prior to calling WinWaitActive, and wire in "BBLIST" for the strTitle input of WinWaitActive.

I'm still curious about the keybd_event function, though.
0 Kudos
Message 13 of 16
(900 Views)
I took a look in more detail. The one problem with the VI is that you need to convert the filename to uppercase. Otherwise you'll get the wrong character codes. The conversion to U16 is unnecessary, but other than coercion dots it doesn't cause a problem. The other problem is that the scan codes should not be 0 for each character that you enter. The keybd_event function is really old and annoying. Attached is a modified version that should work. At least it did on my system.
Message 14 of 16
(888 Views)
Thanks, it works great.
 
After messing with the code for a few minutes I came to the realization that BBLIST does not recognize strings in excess of 12 letters/numbers including the extension. Just something else to work around.
0 Kudos
Message 15 of 16
(869 Views)
That's a DOS limitation (8.3 naming limitation). Given that the app is basically a DOS application, it's not too surprising.
Message 16 of 16
(860 Views)