Jump to content
Sign in to follow this  
scripting164

pass value from java program to autoit exe

Recommended Posts

scripting164

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

Share this post


Link to post
Share on other sites
scripting164

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

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  

  • Similar Content

    • nooneclose
      By nooneclose
      I want to check some Excel data against data on a website in Chrome. I use Chrome because the site I use does not function properly in Internet Explorer or Firefox. I know how to do the Excel stuff I just can not figure out how to send to Chrome, let alone check to see if the data matches or not. I am also having trouble finding any help online while searching for Chrome functions for Autoit. I have a Chrome UDF installed but I still can not figure out how to get my code to properly function. (I am not posting code because I am  sure my code isn't right, to begin with)
      As usual, any and all help would be greatly appreciated. 
    • ohaya
      By ohaya
      Hi,
      I have a situation where I need to make one request to get a kind of pre-logon page, then click a link on that pre-logon page, which then returns a login form page, and then fill in information in the form page and submit it.
      How can I handle that using AutoIT?
      I can get the AutoIT script to tab to the link, then send an ENTER, which then causes the FORM page to appear in IE.  However, I cannot seem to get the form object from the FORM page (_IEFormGetObjByName fails when it searches for the form).  Why is that, and how can I get the AutoIT to process the FORM page?
      Thanks,
      Jim
    • JuanFelipe
      By JuanFelipe
      Hello friends, I have a simple question, can I have a variable that is not reset, even if my program is closed?
      That is, I want to make a program that can only be opened once, have a variable $ ini = 0, when it is opened for the first and only time it becomes $ ini = 1, so that it can not use the program a second time, as if it was a test software.
      I do not want the variable to depend on a reading of an external file that is easily manipulated. Thank you.
    • nooneclose
      By nooneclose
      My program has to first search for names in Column D that do not match up with column C. I got that search to work using arrays. It was slow and I could not figure out how to delete them so I just manually put coded the names that do not belong. I found their cell location but I do not know how to store that location and delete it.
      This is what I have so far.
      Local $NameToDelete1[6]  = _Excel_RangeFind($OpenWorkbook, "Smith, Bill") _ArrayDisplay($NameToDelete1, "Excel UDF: _Excel_RangeFind Example 1", "", 0, "|", "Sheet|Name|Cell|Value|Formula|Comment") _Excel_RangeDelete($OpenWorkbook.ActiveSheet, $NameToDelete1[2], $xlShiftUp)  
      Please help, I wanted to have this program done yesterday but I did not see this problem until yesterday. 
    • TrashBoat
      By TrashBoat
      So Im trying to make a simple 2d game and make some sort of collision detection so why not to make a 2 dimensional array but i have no clue how  to write it in multiple lines
      Global $map[5,5] = [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0] something like this but it doesn't work
×