Jump to content

Recommended Posts

Posted

Yes, it is kind of easy to do.  Check help file for Run function with IN/OUT/ERR CHILD option flags.  When the console is up, you can start discussing with it by using StdinWrite and StdOutRead to write and read the IO stream.  Study the examples provided with the help file, it will give you a head start...If you have problem with your script, post the code here and we will gladly help you out.

Posted (edited)

The other approaches, if you think it is too complicated, are :

1- ControlSend the content of the clipboard directly to the DOS console.

2- Interact with the DOS Console Menu by ControlSend (or even just Send) keys. 

But without your code and lack of precise informations from your part, it is hard to tell which is the best solution.

BTW, to define a HotKey look at HotKeySet (if that was part of the question)...

Edited by Nine
Posted (edited)
5 minutes ago, littlebigman said:

to locate a window, and send it the clipboard's content through StdinWrite

If the Window already exists, you cannot link to its stream and use StdInWrite.  You must use Run to initiate the DOS console to be able to use StdInWrite.  

If the Window already exists, then use one of the 2 others solutions I suggested

Edited by Nine
Posted (edited)

This works, but is there no smarter way than waiting between "keystrokes" so that Windows/the app has enough time to play the keys?

#include <MsgBoxConstants.au3>

Opt( "MustDeclareVars", 1 )
Opt("WintitleMatchMode", 2)

If WinActivate("[TITLE:C:\Windows\system32\cmd.exe; CLASS:ConsoleWindowClass]", "") Then
   ;NOK Send("!{SPACE}AP")

   ;Send("!{SPACE}")
   ;Send("EP")

   ;Send("{APPSKEY}")

   Send("!{SPACE}")
   Sleep(500)
   Send("E")
   Sleep(500)
   Send("P")

Else
   MsgBox($MB_SYSTEMMODAL, "", "Window not activated", 5)
EndIf

Google didn't return hits while looking for "AutoIT window open system menu".

--

Edit: V2

#include <MsgBoxConstants.au3>
#include <Constants.au3>
#include <Date.au3>

Opt( "MustDeclareVars", 1 )
Opt("WintitleMatchMode", 2)

HotKeySet("+{INSERT}", "CheckCmd")

While 1
    Sleep(100)
 WEnd

Func CheckCmd()
   If WinActive("[TITLE:C:\Windows\system32\cmd.exe; CLASS:ConsoleWindowClass]") Then
      Send("!{SPACE}")
      Sleep(100)
      Send("E")
      Send("P")
   Else
      Send(ClipGet())
   EndIf
EndFunc

 

Edited by littlebigman

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
  • Recently Browsing   0 members

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