Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Window Interfacing

Status
Not open for further replies.

bkclaw113

IS-IT--Management
Jun 10, 2002
71
US
I want to be able to interface with the DOS Command Window using Access VBA. I have tried using the shell command with the sendkeys function, but have not been able manage the time aspect. I either need long wait times between each send keys command, or access is sending the next command before the previous one is finished processing.

Ultimately what I want to do is have access run a program from the command window then send a series of commands to the program as it finishes processing each previous command.
Any suggestions would be helpful.
 
If all the commands are alphanumeric characters and the ENTER key, you can try this:

From your module, write a text file that contains a list of commands to send to the program, one command on each line. When you start the program, redirect its input stream to the text file, like this:

myprog < commands.txt
 
I shouldn't have really said alphanumeric characters; it includes all characters you can type into a text file. I've never tried this, but you might be able to use the text file to send escape sequences by actually emitting the ASCII value of the ESC key (27) to the text file.
 
dds82,
I have not worked with redirecting the input for a program in a windows environment before only unix. I created a Macro and used the RunApp action with your suggestion put into the command line field myprog.exe < c:\path\textcmds.txt, it opens the program but does not seem to be receiving any input from the text file.

Would you please elaborate on how to redirect the input if I am doing something wrong.
 
AFAIK, redirecting the input in DOS/Win is the same as in UNIX. However, the Windows equivalent may not be as powerful. I think I've encountered problems under Windows when the input the program is waiting for doesn't need to end in an ENTER press.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top