Jump to content

Check to see if a text string is in a command prompt window?


Recommended Posts

Is there a way for AutoIt to check if certain text is in a command prompt window, or (possibly a better option) check the lowest line on a command prompt window? I'd rather not just use the sleep function and hope that it waits long enough for each process to finish.

Edited by ponchato
Link to comment
Share on other sites

  • Moderators

ponchato,

Look up StdoutRead in the Help file. It lets you read the contents of the Command prompt - so you can wait until you get your required text. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

ponchato,

Look up StdoutRead in the Help file. It lets you read the contents of the Command prompt - so you can wait until you get your required text. :mellow:

M23

AIUI, it doesn't really read the contents of a Command Prompt window, it captures the output of a process and prevents it from appearing in a Command Prompt. And you have to run the process with a specific capture flag, so it can't work on existing Command Prompts. Am I right? I could never get it to work, though, so I may be mistaken.
Link to comment
Share on other sites

AIUI, it doesn't really read the contents of a Command Prompt window, it captures the output of a process and prevents it from appearing in a Command Prompt. And you have to run the process with a specific capture flag, so it can't work on existing Command Prompts. Am I right? I could never get it to work, though, so I may be mistaken.

You are right: you cannot capture text buffer from Command Prompt window (at least not with standard Windows API) because cmd paints text directly on its virtual screen, thus for the rest of the OS it's just a bitmap.

But I think the OP didn't mean it that way, so the reply from Melba23 is adequate.

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Link to comment
Share on other sites

  • Moderators

doudou,

the reply from Melba23 is adequate

Thank you for the vote of confidence! :(

PhilHibbs,

I agree I could have gone into more detail, but given the (assumed) relative inexperience of the OP and the implied requirement to check for the end of running processes, I went for simplicity - KISS. :mellow:

I am sorry to hear you cannot get Stdoutread to work - I have used it successfully many times. Can you get the Helpfile example to run?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...