Page 1 of 1

How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 01 Jun 2022 13:31
by goodywp
Hi all,

I have a complex scripts to do installation job. This scripts is mainly for manually run so that you can provide value for it or select the option to do then hit the enter to continue the job.
Now my question is if I want to run in command line without interactive response, in other words it will pick up the option or value by itself (or automatically).

I could think of two options
1) modify the scripts to use wanted value or option to pick..
2) or no touch the original scripts add some extra file to feed this script to do the automatic installation.

I prefer to use second choice since I do want to touch or modified the original one. If there is no choice other than to modify the original scripts then I will do..

Any thoughts?

Thanks

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 02 Jun 2022 10:49
by aGerman
Difficult to tell without knowing what scripts you're talking about. However
  • While a script is waiting for input its execution is interrupted. So, you need another asynchronously running process to somehow react and send the expected input exactly to the right window and exactly at the right time.
  • Pure Batch can't interact with a window. There's no native way to emulate mouse or keyboard input without using either another language or a 3rd party utility.
Thus, it would be probably far easier to update the scripts to accept command line arguments, or to expand variables defined in the main script.

Steffen

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 03 Jun 2022 07:05
by miskox
Steffen already summairezed it. But if you have only batch scripts you could use a special .txt file with prefedined answers (but in this way you have to copy these two files together). Or you could put them in a batch file itself. Of course some reprogramming must be done.

Saso

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 03 Jun 2022 11:41
by goodywp
The main scripts attached. Also this script used a configure file called Factory.cfg (we can ignore the Customer.cfg)
What I need is to do below steps:
1) I need get rid of pop up (run command line only)
2) First need variable for com.
3) Have option 3 to do Clear Terminal, need get rid of "Enter" manual step by hitting the enter
4) when the above done, next is to do option 1 Load All with Profile
Download.zip
main batch file
(17.69 KiB) Downloaded 323 times
Factory.zip
configure file
(558 Bytes) Downloaded 299 times

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 03 Jun 2022 14:57
by aGerman
goodywp wrote:
03 Jun 2022 11:41
What I need is to do below steps:
Sounds like you have some work to do :)

Steffen

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 04 Jun 2022 11:41
by goodywp
goodywp wrote:
03 Jun 2022 11:41
The main scripts attached. Also this script used a configure file called Factory.cfg (we can ignore the Customer.cfg)
What I need is to do below steps:
1) I need get rid of pop up (run command line only)
2) First need variable for com.
3) Have option 3 to do Clear Terminal, need get rid of "Enter" manual step by hitting the enter
4) when the above done, next is to do option 1 Load All with Profile

Download.zipFactory.zip

Re: How to handle pop or manual input in an existing batch less touch the original scripts file

Posted: 09 Jun 2022 08:02
by goodywp
FYI, I made a new simplified one. Thanks all!