01-17-2017 01:17 PM
Hello All,
I have a .bat file which I run using System Exec VI.
After starting, the user will be required to hit 1 twice so that the programme can be executed. I want to avoid hitting the keyboard, so I can send this through labview so my programme runs fully Automated without any Input from the user.
I tried this without success maybe someone has an idea how I can implement this. Also I will like to read the result from the cmd window after the execution.
thanks in advance for your suggestions
Solved! Go to Solution.
01-17-2017 01:58 PM
So why not prompt for user input within Labview before starting the CMD? That way, the CMD prompt is only used for running the compile routine.
01-17-2017 02:18 PM
After rereading your question, I understand what you are saying. I was assuming you have source code for the routine and I think that was a wrong assumption. You want to start the routine, simulate two keypresses with Labview and let it run.
I think you will need to dip into Windows dlls or .NET to accomplish that. I posted a link in another post earlier today about calling a CMD prompt from .NET (which I think would be possible...not having done it myself). This .NET function would potentially return a window handle that you could then use to send some simulated keyboard input. The .NET constructor is System.Diagnostic.Process. Give it a try and see what happens.
http://stackoverflow.com/questions/691716/running-cmd-commands-via-net
01-17-2017 02:33 PM
thanks aputman, I will try it.
01-17-2017 04:30 PM - edited 01-17-2017 04:32 PM
You shouldn't have to simulate anything. System Exec has a standard input for just such an occasion. Call your bat file in the command line and send the input in through the standard input. Or maybe I misunderstood you?
01-18-2017 02:34 AM
Hello Billko,
You did not misunderstand me. I did that "sending 1 through the Std Input" but nothing happens.
Maybe I am missing something.
Thanks
01-18-2017 11:53 PM
@Frank_view wrote:
Hello Billko,
You did not misunderstand me. I did that "sending 1 through the Std Input" but nothing happens.
Maybe I am missing something.
Thanks
Ugh, I didn't the /k switch. I'm not sure it works with that switch.
01-25-2017 02:01 AM - edited 01-25-2017 02:02 AM
Hello all,
thank you for your responses and contributions. I have a solution which I can now use. I saw a VI made by user "Michael_W." on "Programmat
I have used one of the VI's to simulate my keyboard input when needed and it works as required.
Attached is a rough and quick implementation with the VI.
Thanks