I am looking for a way to grab the results from a CMD text window. I have my script send a command and in return I get either TRUE or FAULSE
I tried gettextatpoint and the other get text options but it never comes back with a result.
any ideas?
Reading Results From CMD window
Moderators: Dorian (MJT support), JRL
Re: Reading Results From CMD window
Have you tried running the DOS command from within Macro Scheduler and redirecting the results to a text file. You can then read then delete the file.
Code: Select all
Let>RP_Wait=1
Let>RP_Windowmode=0
RunProgram>cmd /c dir c:\*.* > %temp_dir%CDriveList
ReadFile>%temp_dir%CDriveList,vData
DeleteFile>%temp_dir%CDriveList
MDL>vData
Re: Reading Results From CMD window
That would work but I am running a program from the command window so I can't send commands that way. I need to find a way to capture the text from the cmd window.
Re: Reading Results From CMD window
There is a method to put Command Window text to the clipboard. You could just automate that series of steps.
1 - Right click on the window client area.
2 - pick "Mark" from the menu.
3 - Hold the shift key and arrow right then down to highlight the text
4 - Press Enter to put the highlighted text to the clipboard.
5 - use GetClipBoard> to put the text to a variable.
6 - Parse to acquire your answer.
1 - Right click on the window client area.
2 - pick "Mark" from the menu.
3 - Hold the shift key and arrow right then down to highlight the text
4 - Press Enter to put the highlighted text to the clipboard.
5 - use GetClipBoard> to put the text to a variable.
6 - Parse to acquire your answer.
Re: Reading Results From CMD window
maybe this wil help you:
of course you dont have to start the dos program if its allready started, but its just to show you the example,
kind regards,
Djek
Code: Select all
//run dos
Let>RP_Wait=2
Let>RP_Windowmode=1
RunProgram>cmd
wait>1
//focus it
SetFocus>c:\Win*
//run dos program
sendtext>dir c:\*.*
Press ENTER
wait>1
// now grab text from program
gettextinit
GetWindowTextex>c:\wind*,vData
MDL>vData
kind regards,
Djek