Jump to content

pass value from java program to autoit exe


Recommended Posts

Hii,

I am using selenium rc with java and trying to upload file for test using autoit. I am able to do the same, but I have to write a new script for each file to be uploaded for different scenarios.

Is there any way to pass file name as a parameter to the script, so that I can use only one script file.

I tried this but it gives Error: Array variable has incorrect number of subscript

Here is my script upload.au3:

#include<IE.au3>

If $CmdLine[0] < 2 Then

WinWait("Choose File to Upload")

$hChoose = WinGetHandle("Choose File to Upload")

ControlSetText($hChoose, "", "[CLASS:Edit; INSTANCE:1]",$CmdLine[1])

sleep(2000)

ControlClick($hChoose, "", "[CLASS:Button; INSTANCE:1]")

EndIf

And I am calling from java as below:

_selenium.click("id=movie-path");

String[] cmd = {path_to_file };

Process proc1 = Runtime.getRuntime().exec( "uploadfile3.exe",cmd);

Help needed...

Link to comment
Share on other sites

Now I am able to pass value..

There was small mistake in calling java program.. It should have been:

Process proc1 = Runtime.getRuntime().exec( "uploadfile3.exe cmd");

But now I am facing another issue. Since I have to pass value multiple times in the program, exe holds the previous value on first call and changes to the desired value on second call.

Any idea how it can be solved??

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

×
×
  • Create New...