Jump to content

How do I check if command prompt requires input?


Recommended Posts

I am trying to automate the execution of several commands currently carried out manually in routine server maintenance sessions. Some of the commands would prompt the user for input mid-execution, and would pause execution until the user enter said input. My intent is for the script to execute the commands, detect when cmd prompts for input, then notifies the user to enter it, which the script will write into stdin.

Currently, I don't know how to detect said prompts. First, listening for specific strings from stdout isn't feasible for two reasons: 1) These prompts do not occur everytime I execute the script - e.g. chkdsk on C:\ could require user input when I execute it this month, but would complete smoothly without needing user input when I execute the script next month. It's not deterministic. 2) The script is executing different commands - not just chkdsk - and consequently different possible prompt messages. Second, implementing an infinite loop to listen for pauses in stdout wouldn't work, because some commands (again, such as chkdsk) can be running for extended lengths of time without printing any output, so this implementation would risk triggering false positives.

How do I accurately listen for cmd asking for user input, regardless of what prompt message is printed out?

Note: I'm using AutoIT v3.3.8.1, and the script will be run in a Win2K environment.

Edited by thegreatjedi
Link to comment
Share on other sites

#include <Constants.au3>
#include <Array.au3>



 ;Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get name" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
 ;Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get caption" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
 Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get deviceid, volumename, description" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
 Global $cData = ""
      While 1
        $line = StdoutRead($cDisk)
        If @error Then ExitLoop
        $cData &= $line
      WEnd


 MsgBox (0,"",""&$cData)

$cSplitedData = StringSplit ($cData,@CRLF)
$cStripedData = StringStripCR ( $cData )
$cSplitedStripedData = StringSplit ($cStripedData,@CRLF)

_ArraydDisplay ($cSplitedStripedData)

Hello Welcome . You are lucky I already prepared something for someone. That needed the same as you. You can work with this. Or maybe someone got a better way. 

But be aware we should not come and give a code like that :p. You have to prepare you code so we can help you on it. For next time :).

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Sorry, but I don't think your reply answered my question at all. As far as I can tell, it just retrieves a list of disks and prints out info for them. That's completely unrelated to my question.

I'm asking if, after getting cmd to run a command, whether there's a way to detect if cmd is waiting for user input.

I have no code to provide because 1) I've already mentioned the possible solutions I can think of, but already ruled them out because I know they're infeasible or unsuitable for my needs without needing to try and implement them. 2) Being out of ideas, I consequently wouldn't be able to start coding to begin with.

What I want to know, is whether there's something in the API I don't know of that I can try. I've searched the forums, but the most relevant results I can find are those I've mentioned and ruled out.

Link to comment
Share on other sites

OK 😂

Ofc it dont do yet what you want i wont rework it for you

But i know that you can do what you want with this code. Nvm np. 

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I help you a bit :P.... Why do you got a list of drive ? ;) 

 

Try to change this : 

wmic logicaldisk get deviceid, volumename, description

By what you use.

And run the script again.

 

Or should i say, try run this in Cmd consol

wmic logicaldisk get deviceid, volumename, description

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Alright, I executed that command in cmd like you asked, and the screenshot shows what I got.

It's like I was trying to tell you. The command executed on its own and finished. It doesn't ask for any input from the user mid-way. That is the problem I'm seeking to solve so this example you gave has no relevance.

What your script is doing is:

  • Read the stdout printed from the command being executed
  • Append the string read to a variable
  • Stop and exit loop when EOF is reached
  • Display the variable's value to the user.

Alright, let me try to give a clearer example of what I'm dealing with:

  • I execute the following command in cmd:
chkdsk c: /f
  • chkdsk outputs a lot of stuff to stdout
  • chkdsk reaches a step where it takes a long time to execute (minutes). Nothing is output to stdout during this time (A)
    • When I worked on other parts of my application, I've established that pauses such as this isn't EOF and won't trigger @error, so I can't use the while-loop + if-statement combination from your script.
  • After several minutes, chkdsk continues to the next step, and starts to output a lot of stuff again.
  • chkdsk reaches the step where it needs to fix the disk, but it MAY output a message prompting the user to input a value.
  • chkdsk pauses execution as it waits for the user to input a value. (B)
    • Again, no EOF or @error is triggered by this pause.
  •  Once user input is written into stdin, chkdsk continues and completes. EOF occurs and @error is finally raised. (C)

There are three states in this process where the output from stdout would pause. I need a way to know when the pause is because it is waiting for user input (i.e. B), and NOT because of the other two reasons (A & C). Your solution checks for C which isn't what I'm looking for, and I can't see how to modify it to check for B and only B instead.

I do not know what are all of the possible messages that will be output from stdout when user input is required, so I can't do a stdoutread and compare it against a list of substrings - it won't cover all of the possible scenarios.

Screenshot.png

Link to comment
Share on other sites

Re,

 

It is becose you keep this :

@SW_HIDE

 

Replace with this :

@SW_SHOW

Then now use your cmd command insteed of mine.

If we start from here. You should got that:

#include <Constants.au3>
#include <Array.au3>



 ;Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get name" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
 ;Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get caption" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
 Local $cDisk = Run(@ComSpec & " /c chkdsk c: /f" , @SystemDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
 Global $cData = ""
      While 1
        $line = StdoutRead($cDisk)
        If @error Then ExitLoop
        $cData &= $line
      WEnd


 MsgBox (0,"",""&$cData)

$cSplitedData = StringSplit ($cData,@CRLF)
$cStripedData = StringStripCR ( $cData )
$cSplitedStripedData = StringSplit ($cStripedData,@CRLF)

_ArraydDisplay ($cSplitedStripedData)

I am trying now but it should wait your input like a normal cmd windows.

 

 

Also keep in mind this is for read output. Nothing else.

chkdsk outputs a lot of stuff to stdout

Sometime you got no choice.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I mean if you want a solution to Get what is in your windows with 3 click it will be unsafe but i can lead you on how to do so.

 

Something like ClipGet

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@thegreatjedi
Maybe this could help you a little bit:

Global $strBatchFileName = @ScriptDir & "\Sample.bat", _
       $intPID = 0, _
       $strSTDOutRead = ""


$intPID = Run($strBatchFileName, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
If $intPID = 0 Then
    ConsoleWrite("Error while running the application '" & $strBatchFileName & "'. Error: " & @error & @CRLF)
Else
    While 1
        $strSTDOutRead &= StdoutRead($intPID)
        If @error Then ExitLoop
        If StringInStr($strSTDOutRead, "Type") Then
            StdinWrite($intPID, "Y") ; Change "Y" to "N" to see the other choice 
            StdinWrite($intPID)
        EndIf

    WEnd

    MsgBox($MB_ICONINFORMATION, "", $strSTDOutRead)
EndIf

Content of Sample.bat:

@echo off
:Ask
echo Some question?(Y/N)
set INPUT=
set /P INPUT=Type input: %=%
If /I "%INPUT%"=="y" goto yes 
If /I "%INPUT%"=="n" goto no
:yes
echo You choosed Yes!
exit
:no
echo You choosed No!
exit

You need to know exactly what to look for in your command executions, so you can provide the various choices needed :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

@FrancescoDiMuro So what you're saying is that to know whether cmd is waiting for user input, I must know in advance the message printed to stdout that's prompting the user for it? If I don't know every single prompt message I could receive in this application and it's not possible to do so, does that mean I'm screwed?

So there's nothing in the API I can use to check whether the cmd process is in a "pending stdin input" state? I was hoping there's something like that.

Edited by thegreatjedi
Link to comment
Share on other sites

@caramen I'm back at work, and tried the code you shared to be certain. As I expected, it only prints out the output obtained from stdout. I already know how to do that. This would be usable if I know what message I would receive when cmd prompts for input.

Problem is I don't. It's not possible for me to know all the messages that would prompt me for input. So I can't compare the output against a list of strings to find a match.

$cmdProc = Run(@ComSpec & " /c " & $commandToExecute, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

While True
$newOutput = StdoutRead($cmdProc)
#cs
  ; Pseudocode
  If @error Then
    ; EOF
    ExitLoop 1
  ElseIf $newOutput == ""
    If waitingForUserInput Then
      $splittedOutput = Split $newOutput by line into array of non-empty strings
      $input = InputBox("", $splittedOutput[UBound($splittedOutput) - 1]) ; Assumes last line is the string prompting user for input
      StdinWrite($cmdProc, $input)
    EndIf
  Else
    Sleep(300)
  EndIf
#ce
WEnd

How do implement the check for waitingForUserInput when it's not possible for me to know beforehand what the prompt message is?

Edited by thegreatjedi
Link to comment
Share on other sites

If you can't rely on checking the output to determine which command(s) are halting your process/script, how do you expect to know how to respond with proper input?

Can you give a real-world example of what you are running into?

Link to comment
Share on other sites

quit simple he is doing a check disk and he want to check if the chk dsk command ask him to repeir etc....

And i assume he want to auto answer to receive questions.

 

The problem is different for you i guess now. What is the return value of

$cSplitedData = StringSplit ($cData,@CRLF)
$cStripedData = StringStripCR ( $cData )
$cSplitedStripedData = StringSplit ($cStripedData,@CRLF)

 

1?

chkdsk need admin right and UAC prompt disabled to be run with comspec i have to do some test bro to be sure becose i never used.

If yes you need admin rights.

#RequireAdmin

 

ALSO the most simple way to do what you want is to do the same with the windows GUI....

 

I ll give it a shot when i am back at work me too.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

About the logic...

Just while your chkdsk is running you do a loop until you got the next answer or an other answer. when you ll have the read outpud routine ready....:

Question 1 ; possible answer = ;Y or N

Do

check $input Y or N

Until $input = Y or $input = N

If $input = Y

ElseIf $input = N

EndIf

Question 2 ;blabla

....

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@spudw2k This script is for automating monthly maintenance tasks currently run manually command-by-command on numerous servers at work. I can't go into too much detail due to confidentiality issues, only that chkdsk is one of the commands run.

Using chkdsk as an example, if I run chkdsk /f, at least two possible prompts can appear (that I know of): the first asks if I want to force a dismount of the drive, while the second asks if I want to run chkdsk during system startup after reboot. These two don't always happen when I run chkdsk on the many drives and servers that need to be maintained - sometimes the whole check completes without requiring user input.

And that's just one task. There are other commands to be run. The user clicks on buttons on a GUI to select which command to run, so we always know which one has halted to wait for user input. These commands are passed into a functions to be executed, which is something like what's in my previous post. However, it is not feasible to know all of the possible prompt messages that could be returned when the process halts to wait for user input, so trying to iterate through a list of messages to find a match is not foolproof enough to be used.

#cs
  ; Pseudocode
  If processState == waitingForUserInput Then
    $input = InputBox("", $promptMessage)
    StdinWrite($pid, $input)
  Else
    Do Nothing
  EndIf
#ce

Currently, an assumption is made that if the process is waiting for user input, it will stop returning new output to stdout, and the last line returned is the prompt message. The script is using this assumption to obtain the value for $promptMessage. This message will be displayed to the user via a GUI, who will then submit an input which the script will pass to the process via stdin.

A possible way to check is:

If NotEOF AND NoNewStdoutOutput Then
  ; Process is waiting for user input
  Do stuff
Else
  Do nothing
EndIf

The problem with this is that, with the chkdsk example, there are times when the process is running without returning any new output to stdout for long, variable periods of time, which can easily extend into minutes, but isn't requiring user input. So the above approach can't work because it'll catch false positives.

So the question is: Is there any way to check if the process' current state is "waitingForUserInput", that isn't process or prompt message-specific?

 

@caramen See above as to why I can't check for matches of specific string values. Also, this script will be run on a Win 2000 OS environment so there's no UAC or stuff like that. And it'll be run on the system admin account so the account running the script has universal access rights.

Edited by thegreatjedi
Link to comment
Share on other sites

Hmmmmm I just had an other idea that i used for a tool of me. 

 

Look... If you hardcode it enouth i think you can do somthing stable enouth... But will require a bnch of test with you before you leave the script alone.

 

You can send a CTRL + A 

You can also send a CTRL + C Or maybe right click i dont know ms-DOS on server 2K

 

Then you do ClipGet 

FileWrite ( clipget ) 

 

File read.... 

 

Unfortunatly it is the most unsafe way to do it but maybe your only way. The most important thing will be to get ms-dos handle and work with it. 

 

 

 

Since it s a server and you wont get an user on it, playing with that screen.  You can do somthing like that... It will be soooooo Fu** easy!

And the CTRL + A is working on MS-DOS.

 

Like that you can check and run 5 chkdsk on the same machine. Very easy... 

Winactivate ($Hnd)

CTRL + A 

CTRL + C 

FileWrite ( clipget ) 

FileRead

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@thegreatjedi I understand the issue, and can appreciate the difficulty with the challenge at hand.  I could not find a particularly elegant way to determine if a console application is awaiting input.  I still don't understand how you can expect to know what to respond with if you don't know what the input prompt is asking for. 

21 hours ago, thegreatjedi said:

It's not possible for me to know all the messages that would prompt me for input.

If that is true, how do you expect to know how to respond in an automated fashion?  You can't/shouldn't expect to input Y for any halting prompt...right?  You want to be sure you respond with valid and appropriate input. 

I really think capturing the output and know what 'keyword/text' to look for to know what prompt is being presented and thus how to respond is not a terrible way to go.  I can appreciate you might not have all the output/prompt text, but I would think you should be able to get it.

You should be able to track where in your list of task you are, know what process is running and have--say an array of--text to look for with a matching input response.

Link to comment
Share on other sites

@thegreatjedi

I want an udf to do that. 

 

I will make one. If that interest you, PM me.

 

We can do it together. Gonna help.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Quote

If that is true, how do you expect to know how to respond in an automated fashion?  You can't/shouldn't expect to input Y for any halting prompt...right?  You want to be sure you respond with valid and appropriate input.

@spudw2k There's a GUI presented to the user to run different maintenance tasks from, and is intended to be the only interface the user will interact with. The intended design right now is that if the process is waiting for input, we'll display to the user the last line(s) read from stdout before it paused, on the assumption that that is the prompt message, and the user will enter a response into the GUI, which the script will then write into stdin.

What we are automating here is to turn the sequence of actions executed during maintenance into a single click. The script will be run by the same folks who've been working manually with the command prompt all this time, so there's no significant concern with checking the input. They just need to know what the process is asking for, which will be told through the prompt message given. We will know which process is currently running since a log in the GUI will be updated whenever a new command is being executed.

"You can't/shouldn't expect to input Y for any halting prompt" - that's the exact question this thread is about. I think I already have a way to identify "no output and process ended", but I still need a way to differentiate between "no output, paused and requires input" vs. "no output, still running and doesn't require input".

Quote

I really think capturing the output and know what 'keyword/text' to look for to know what prompt is being presented and thus how to respond is not a terrible way to go.  I can appreciate you might not have all the output/prompt text, but I would think you should be able to get it.

You should be able to track where in your list of task you are, know what process is running and have--say an array of--text to look for with a matching input response.

I've already mentioned the input part is provided by the user and not automated in the first half of this reply so I'll skip that.

It's not that I don't want to use this method, but it's not good enough. Getting the entire output from stdout isn't the issue, it's that I don't have a good way of getting a complete array of text to compare that output against to know whether there's a prompt-for-input in it. That can work for a few tasks, but not all. For example, a few commands are system commands, for which I don't know how to obtain the list of all possible prompt messages, if at all possible. The ones I've observed so far occur only because the user environment consist of ageing server hardware running Win2K that's EOL - something I can't replicate well in a development environment with brand new PCs running Win10, even in a VM. There's also the matter that the long-term plan for this script is to deploy it for use in the maintenance of all current and future projects in the company, so keeping this waiting-for-input-check generic is the preferred future-proof way going forward (the string-matching approach may not even be a feasible option at all in these circumstances).

The last resort is to print everything captured from stdout into a Edit GUI Control and show it all to the user, and let the user determine if it's waiting for input, and to have a separate input field to capture the user's input and blindly send everything to stdin whenever the user clicks a submit button. That's basically replicating the command prompt within the GUI though. I was hoping there's a smarter way to go about it, such as maybe an existing function in the API, or some kind of logical state or flag I can check to determine the process' current status, or something to that effect, that is independent of stdout output string values.

Edited by thegreatjedi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...