DOS command to launch program after input detected

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
FrankOC
Posts: 4
Joined: 22 Apr 2014 09:24

DOS command to launch program after input detected

#1 Post by FrankOC » 22 Apr 2014 09:29

Hello,

Is it possible for a program to be launched via DOS after it detects input by the user?

The user will be scanning a Part number (e.g. P1234) at the DOS prompt.
Once this is detected the application Excel.exe will need to be launched.

Is it possible to do this?

Thanks.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: DOS command to launch program after input detected

#2 Post by Squashman » 22 Apr 2014 09:47

That depends.
What do you mean by scanning? Do you have some application that uses a barcode scanner?
We would have no control over what the application can do.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: DOS command to launch program after input detected

#3 Post by foxidrive » 22 Apr 2014 10:18

FrankOC wrote:Is it possible for a program to be launched via DOS after it detects input by the user?
The user will be scanning a Part number (e.g. P1234) at the DOS prompt.
Once this is detected the application Excel.exe will need to be launched.


This is in Windows, right?

With the right conditions a batch file can be run to launch the scanner software and then to launch excel.

If you supply details about the process then you may get a solution.

FrankOC
Posts: 4
Joined: 22 Apr 2014 09:24

Re: DOS command to launch program after input detected

#4 Post by FrankOC » 23 Apr 2014 01:59

Hi guys,

Thanks for the replies.

Here is the scenario:

1) The user arrives at the Windows 7 workstation with a barcode.

2) User scans barcode using the attached handheld Honeywell Scanner and this triggers Excel application to launch.

Is it possible for DOS to detect input from the scanner?
If so is it possible to create a batch file which launches Excel after data is scanned into the DOS screen e.g. A product's part number.

Thanks

FrankOC
Posts: 4
Joined: 22 Apr 2014 09:24

Re: DOS command to launch program after input detected

#5 Post by FrankOC » 23 Apr 2014 05:46

Yes this is in Windows 7.

1) The user will scan a barcode using a Honeywell handheld barcode scanner attached to the Windows 7 workstation.

2) The script will detect that the barcode contains a min requirement of digits e.g. Part Number 012345. Once this minimum condition is met Excel application will be launched and the part number entered in spreadsheet.

Regards

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: DOS command to launch program after input detected

#6 Post by Squashman » 23 Apr 2014 08:08

Whatever program is controlling the barcode scanner would have to do that.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: DOS command to launch program after input detected

#7 Post by foxidrive » 23 Apr 2014 08:54

FrankOC: Where does the output of the barcode scanning program go?

Does it get echoed to the cmd console? Is it in a file?

More information is needed.

aGerman
Expert
Posts: 4744
Joined: 22 Jan 2010 18:01
Location: Germany

Re: DOS command to launch program after input detected

#8 Post by aGerman » 23 Apr 2014 10:33

Barcode scanners usually emulate simple keyboard input. That means whatever application should receive the input has to have the keyboard focus (at least a Batch window has to). You can also adjust the scanner to append a line feed to the scanned string. This way you can use a simple SET /P command to get the string into a variable. Batch can also measure the string length and you can check if the input was numeric only and open an Excel file. But you can not insert the string into a spreadsheet using Batch only. You would have to run an Excel macro that reads the value out of a file or something similar.

May I suggest to use an Excel VBA form with a macro behind the scenes? Excel would be already open and the form could have the keyboard focus. Thus, the scanner input ends up directly in the application where it was expected.

Regards
aGerman

FrankOC
Posts: 4
Joined: 22 Apr 2014 09:24

Re: DOS command to launch program after input detected

#9 Post by FrankOC » 24 Apr 2014 07:39

Thank you for all of your replies.

Having read aGerman's suggestion of using a macro this will be the route I will take.

Thank you all for your input.

Best regards,
Frank

Post Reply