Hi,
I am calling following autoIt script with selenium
#include <file.au3>
AutoItSetOption("WinTitleMatchMode","2")
_Log("----new session----")
if $CmdLine[0] < 2 then
; Arguments are not enough
msgbox(0,"Error","Supply all the Arguments, Browser name and path to upload")
_Log("Arguments are wrong")
Exit
EndIf
;Actiate firefox/IE browser
If (StringCompare($CmdLine[1],"firefox",0) = 0) Then
$title = WinGetTitle("Mozilla Firefox") ; retrives whole window title
_Log("FireFox selected")
ElseIf (StringCompare($CmdLine[1],"ie",0) = 0) Then
$title = WinGetTitle("Windows Internet Explorer")
_Log("IE selected")
Else
Exit
EndIf
$hResult = WinActivate($title);
If($hResult == 0) Then
_Log("Unable to find "&$title)
Else
_Log($title&" activated")
EndIf
Sleep(2000)
;Handling of Request Authentication pop up if visible
if WinWait("Request Authentication","",20) Then
$hResult = WinActivate("Request Authentication");
If($hResult == 0) Then
_Log("Unable to find Request Authentication")
Else
_Log("Request Authentication activated")
EndIf
sleep(1000)
Send("{ENTER}")
EndIf
;mouse click for enable open dialog box
Sleep(20000)
MouseClick("left", 370, 494, 2)
;open dialog
WinWait("Open")
$title = WinGetTitle("Open") ; retrives whole window title
WinActivate($title)
WinWaitActive($title)
Sleep(1000)
$fullpath = $CmdLine[2]
Send($fullpath)
Sleep(1000)
Send("{ENTER}")
;used for logging
Func _Log($sLogMsg)
_FileWriteLog(@ScriptDir & "\AutoItLog.log",$sLogMsg)
EndFunc
In java code as :
dialog = new String[]{ "MultiFileUpload1.exe","firefox","E:\\Shared" };
Runtime.getRuntime().exec(dialog);
Thread.sleep(50000); // Need other solution (1)
Everything is fine except (1). I need to provide sleep for 50 sec. because i am not able to identify when autoIt script finish using java So i have added fix maximum number of seconds when my script will finish.
If anyone known other solution for getting how to know that script is executing or not finish.
Thanks,
Ravi