Jump to content

RaviJ

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by RaviJ

  1. Hi, I am passing unicode character from java to autoIt script as : String filePath = "E:\\ravi\\腿哦哦予以.ppt"; System.out.println(filePath); String exeFile = "SingleFileUpload.exe"; //autoIt script dialog = new String[]{ exeFile,"ie",filePath }; Runtime.getRuntime().exec(dialog); But when i access filePath parameter from autoIt script, i am getting as ???? instead of correct value of parameter. MsgBox(0, "File Path:", $CmdLine[2]) ControlSetText($title,"","Edit1", $CmdLine[2]) Getting E:\ravi\????.ppt as value of $CmdLine[2] which is filePath Thanks, Ravi
  2. Hi, I was also encountered same problem and i resolve it as : First activate ff/ie browser using its title, then getting position of applet and apply mouse click by adding some value in position because buttons are present somewhere on the applet. $title = WinGetTitle("Mozilla Firefox") WinActivate($title); Sleep(2000) $pos = ControlGetPos($title, "", "[CLASS:MozillaWindowClass; INSTANCE:7]") MouseClick("left", $pos[0]+73, $pos[1]+311, 2) May be its help for you. Thanks, Ravi
  3. I have got another workaround for it. The another solution is : int count = 0; while (isProcessRunning("MultiFileUpload.exe") && count <= 50) { Thread.sleep(1000); // like WinWaitActive count++; } public static boolean isProcessRunning(String processName) { try { String line; Process p = Runtime.getRuntime().exec("tasklist /FI \"IMAGENAME eq " + processName + "\""); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { if (line.contains(processName)) { input.close(); return true; } } input.close(); // the process was not found } catch (Exception err) { err.printStackTrace(); } return false; } Copy from the following post : #837631 Thanks, Ravi
  4. 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
  5. Thanks again JohnOne Using Send($var) : Now I can type value in to edit field and then i use Send("{ENTER}"). Thanks, Ravi
  6. I tried to get controls using Au3Info but not getting any info except Title and class. The output of summary tab is : >>>> Window <<<< Title: Open Class: SunAwtDialog Position: 217, 143 Size: 590, 431 Style: 0x96CC0000 ExStyle: 0x00000100 Handle: 0x002F07C0 >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 372, 345 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<<
  7. Thanks JohnOne for the reply. Actually i am using autoIt with selenium. So I do first activate firefox browser(where selenium is executing.) My app used java applet for uploading data. Now using autiIt script first i click on button and activate open dialog. * I used your solution ControlFocus() but not getting any luck I don't know how to identify control id for particular control. How can i get the control id. I also attached a screen shot of my dialog. Thanks, Ravi
  8. Hi, I am using following script for handling open dialog AutoItSetOption("WinTitleMatchMode","2") $title = WinGetTitle("Mozilla") ; retrives whole window title WinActivate($title); MouseClick("left", 380, 485, 2) WinWait("Open") $title = WinGetTitle("Open") ; retrives whole window title WinActivate($title) WinWaitActive($title) Sleep(2000) $fullpath = "C:\Documents and Settings\ravi.jain\Desktop\AutIt\scripts" ControlSetText($title, "", "Edit1", $fullpath) All is working fine but in the last line : ControlSetText is not working and i am not able to type a file name in to edit field. Please let me know the solution. Thanks, Ravi
×
×
  • Create New...