LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

keybd_event for dos application

I have a dos application that I am trying to control with keybd_event. I have executed and operated external applications in a loop in the past but I cannot seem to pass any keys to this particular application. Attached are the vi and the executable. You will have to change the working and exe path to see an example of my problem. Any assistance is greatly appreciated.

0 Kudos
Message 1 of 16
(3,898 Views)
I'm not quite sure what you're doing with that loop there. What are you trying to send? It seems that the stuff to send is based on the directory listing of "C:\bin_to_text", which we don't have.
0 Kudos
Message 2 of 16
(3,878 Views)

What I have is approximately 9000 binary files in the bin_to_txt folder. The vi opens the dos application (BBlist.exe) and sends each of the 9000 file names to the dos application in sequence by sending keyboard strokes.

 

For example, if you were to manually open the BBList program the first thing it asks for is the file name. Therefore, the vi enters the file name one letter at a time as if you were doing so from the keyboard. The outer loop runs once for every file, the inner loop runs once for every keyboard stroke.

 

1. To test the program put BBLIST in your root folder c:

 

2. Make a dummy folder called bin_to_text in your root folder c:\bin_to_text\

 

3. Save a text file of any name you like and put it in the bin_to_text folder

 

4.  Run the VI.

 

The VI should open BBList but nothing else will happen. If it were to work as intended you would see the text file name in the input field.

 

The way the vi works is by passing keystrokes to the active application which is the BBList at the time. To check if the keystrokes are working just maximise a text document right after BBlist opens. The text document will be the active application and you will see the name of the text file you created typed out.

 

Thanks for the reply, I didn't think this would get any attention.

 
 
 
 
0 Kudos
Message 3 of 16
(3,868 Views)
According to the documentation from RDI, it sounds like the program you really need to be using is their batch conversion program BBBATCH. (Page 19 of the RDI Tool Users Guide - available as a pdf file here.)

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 16
(3,855 Views)

Mike,

I have looked into that route and I am working on a solution with Teledyne. BBBATCH does not work correctly. They have recomended an alternative that I'm looking into.

 

0 Kudos
Message 5 of 16
(3,838 Views)
I don't quite understand what keys you're tyring to send prior to the filenames. I would think you just want to send 3 backspaces, but that's not what it seems that you are doing. I used AutoIt to implement an alternate solution which is much cleaner. I've attached it if you're interested in seeing it. I only took it as far as entering a single filename, as I have no idea how the program is supposed to be used.
0 Kudos
Message 6 of 16
(3,830 Views)

smercurio,

 

I get an error on the "automation open". Are you able to pass a string to the application?

 

The three backspaces are not required. Hit any letter and it overwrites the default *.* . The keys you see in the cluster array are random. I stopped at that point because it was obviously not working correctly.

 
0 Kudos
Message 7 of 16
(3,822 Views)
Did you install AutoIt? To answer your question, yes, I was able to send the filename to the application using the AutoIt example I posted.

You said  The keys you see in the cluster array are random.  ... OK, so then what's all that code you're doing in the first inner loop, and the prepending of some characters for? There seems to be a problem with the way keybd_event is being used or programmed. I'm guessing you probably got that example from here.  I'll try to take a look at it later.
0 Kudos
Message 8 of 16
(3,815 Views)

Just a thought, i may be missing the point completely

Is it possible to get LabVIEW to write a text file of the commands you want to send.  Then save this file as a batch file.  Then run this file under system exec.  This way you could do all the listings of files etc under LabVIEW and use system exec to run the command.  for each different file LabVIEW will autogenerate a new Batch file and run it again.

Craig



Message Edited by craigc on 08-08-2008 10:44 AM
LabVIEW 2012
0 Kudos
Message 9 of 16
(3,811 Views)
Yes, Autolt is installed. BBList opens but the curser just sits and blinks to the right of *.*.
 
Sorry about the random comment. What I ment to say is the cluster array constant is random. If the file name string was working the next step is to keystoke "Enter" then "Alt C" etc. The constant will cantain these keystorkes.
 
Before getting to this point I had to do a batch extraction using this vi. It worked flawlessly. The difference is I was controling a windows application (powerarchiver 2001).
 
 
0 Kudos
Message 10 of 16
(3,794 Views)