Jump to content
Sign in to follow this  
raji

How To Pass value from autoit to Java Program

Recommended Posts

raji

Hi,

Im trying to pass the value from autoit script to Java, while running .exe file of autoit from java.

 

This is my Autoit Script:

------------------------------------

Local $EncryptValue=$CmdLine[1]
;"KytWLOHX7cc="
DecryptorValue($EncryptValue)

Func DecryptorValue(ByRef $Encrypt)
Local $exeLocation = "D:\study material\Lyca-decryptor\Lycatel.exe"
Local $iPID=Run($exeLocation)


WinWaitActive("Form1")

ControlFocus("Form1","","WindowsForms10.EDIT.app.0.33c0d9d2")
ControlSetText("Form1","","WindowsForms10.EDIT.app.0.33c0d9d2",$Encrypt)
Call("Sleeper")

ControlClick("Form1", "", "WindowsForms10.BUTTON.app.0.33c0d9d1", "Left")
Call("Sleeper")
Local $Vvalue=ControlGetText("Form1", "", "WindowsForms10.EDIT.app.0.33c0d9d2")
;MsgBox($MB_SYSTEMMODAL, "State and text of the menuitem", "state:" & $Vvalue)
;ConsoleWrite($Vvalue)

 Local $sOutput = StdoutRead($Vvalue)
 ;MsgBox($MB_SYSTEMMODAL, "State and text osdgsg", "state:" & $sOutput)
 Return $Vvalue

EndFunc
WinClose("Form1")

Func Sleeper()
Sleep(1000)
EndFunc

 

This is my Java code:

----------------------------

String Val="KytWLOHX7cc=";
        String D1="D:\\AutoItScripts\\decryptor.exe" +" \""+ Val+"\"";
        System.out.println(D1);
                Process AutoitReturnValue=Runtime.getRuntime().exec(D1);
                InputStream in = AutoitReturnValue.getInputStream();
                System.out.println(in.read());

 

I'm getting -1 as return value from autoit Can someone help me with this??

Share this post


Link to post
Share on other sites
raji

Hi @junkew,

Thanks for ur reply. I tried using stdoutread.This is My autoit script

Local $exeLocation = "D:\study material\Lyca-decryptor\Lycatel.exe"

Local $iPID=Run(@ComSpec & $exeLocation,@SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD)

 

while running the script it is not opening .exe file and not proceeding further.

can u please help me with this..

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.