Jump to content
Sign in to follow this  

Writing to input stream of a process NOT launched by AutoIt scripts

Recommended Posts



I have an issue with writing data to the input stream of a process that was not launched by AutoIt functions (Run function).

I have this process tree:

RAServer.exe (remote agent controller for Junit testing)

-> CMD.exe

-> setupWIN.exe

-> java.exe

It would be of tremendous help if I could write to the input stream of java.exe (java.exe is launched by setupWIN.exe)

I tried to write data using StdinWrite (I gave the pid obtained from tasklist) but it didn't work.

When setupWIN.exe is launched by the RAServer.exe (as the example above), I do not have access to the console of java.exe.

That is why I cannot use the Send function to simulate pressing keys. Therefore, I turned my attention to using processes

but it seems that StdinWrite doesn't work.

Do you have any idea how could I write data to the input stream of java.exe?

Any help will be greatly appreciated.

Thank you.

Share this post

Link to post
Share on other sites

Sorry for bumping this here, but the issue here also pertains to mine. Here's my code thus far; it doesn't seem to function despite being tinkered with for several hours =.="

#include <Constants.au3>
#include <GuiConstantsEx.au3>
$mGUI = GUICreate('My Test GUI', 800, 550, -1, -1)
$sProc = Run('cmd.exe', @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDERR_MERGED)
$sText = GUICtrlCreateEdit('', 10, 10, 780, 500)
$sInput = GUICtrlCreateInput('', 10, 520, 700, 20)
$sEnter = GUICtrlCreateButton('Send', 720, 520, 70, 20)
GUISetState(@SW_SHOW, $mGUI)
While 1
    $msg = GUIGetMsg($mGUI)
    Switch $msg
        Case $GUI_EVENT_CLOSE
        Case $sEnter
            If GUICtrlRead($sInput) <> '' Then
                StdinWrite($sProc, GUICtrlRead($sInput))
                GUICtrlSetData($sInput, '')
    If ProcessExists($sProc) Then
        $sRead = StdoutRead($sProc)
        If $sRead <> '' Then
            $sRead = StringReplace($sRead, @LF, @CRLF)
            $sRead = GUICtrlRead($sText) & $sRead
            GUICtrlSetData($sText, $sRead)
Edited by BoonPek

Share this post

Link to post
Share on other sites

Managed to get that working by adding an "@LF" after sending the input! :graduated:

This doesn't seem to work with java-based apps, though :/

Share this post

Link to post
Share on other sites

does not seems to work for me at all.

commands are not even beeing passed nor to cmd console or scripts edit box.

Share this post

Link to post
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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.