Jump to content

Quick Paste into Cmd Prompt?


 Share

Recommended Posts

Hi,

Just looking to see if anyone knows a good way to paste into a command prompt window - in the GUI I'm working on it has the option of a verbose mode. When checked it shows you it typing in to the prompt rather than hiding it, but so far I can only get it to work using send() which, when you have a few lines to go through multiple times, gets slow.

Also, if anyone has a better way of making sure it activates the CMD window (the title of the window is different in different OSes) that'd be great.

Any thoughts?

Code snippet:

Case $checkverbose = $GUI_CHECKED
            Run("cmd.exe")
            winactivate("[CLASS:ConsoleWindowClass]","")
            winwaitactive("[CLASS:ConsoleWindowClass]","",4)
                for $i=0 to $maxcount-1
                    winactivate("[CLASS:ConsoleWindowClass]","")
                    winwaitactive("[CLASS:ConsoleWindowClass]","",4)
                    send(_GUICtrlListView_GetItemText($ListView, $i, 1))
                    sleep(250)
                    send("{ENTER}")
                    sleep(250)
                Next
                winactivate("[CLASS:ConsoleWindowClass]","")
                winwaitactive("[CLASS:ConsoleWindowClass]","",4)
        EndSelect
Link to comment
Share on other sites

I don't know whether this is something you are looking for but have a look here: http://www.autoitscript.com/forum/index.php?showtopic=121658&view=findpost&p=844465

It will run the command from the inputbox in cmd.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Thanks UEZ, I've used the Run and @comspec combination before (as well as shell execute) and it would work great if only there was a way to run the subsequent commands from the same window rather than separately.

I'll keep looking, though. Maybe there is a way to do it. In the meantime I'm trying to figure out how to use this StdoutRead stuff to capture errors from the non-verbose mode =)

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