diikee Posted May 22, 2008 Share Posted May 22, 2008 (edited) #include <IE.au3>Opt("TrayIconDebug", 1)Opt("WinWaitDelay", 200)Opt("WinTitleMatchMode", 2)Opt("WinDetectHiddenText", 1)Opt("MouseCoordMode", 1)Works:When I click on Snapshot, the Windows "Save As" dialog pops up and is handled accordinglySleep(500)WinWait("Save As","Save &in:")ControlClick("Save As","Save &in:","Button2")WinWait("Save As","")ControlClick("Save As","","Button1")Doesn't work:When I click on login, the login prompt pops up but no buttons are clicked or text fields populatedWinWait("Connect to ","&Remember my passwor")If Not WinActive("Connect to ","&Remember my passwor") Then WinActivate("Connect to ","&Remember my passwor")WinWaitActive("Connect to ","&Remember my passwor")ControlSetText("Connect to", "", "Edit2", "root" )ControlSetText("Connect to", "", "Edit1", "jam" )ControlClick("Connect to ","&Remember my passwor","Button2")why would this render different behaviors if they are initiating same types of popups?? Edited May 23, 2008 by diikee Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 22, 2008 Share Posted May 22, 2008 why would this render different behaviors if they are initiating same types of popups??They may not be the same type of popup. What does the AU3Info.exe data look like for the window? Did you get "Edit1", "Edit2", etc. from there? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 22, 2008 Share Posted May 22, 2008 (edited) Yes, I used the controls from the info toolPerhaps try ControlSend() vice ControlSetText() for those Edit controls? I usually include Sleep(500) after each of those actions so when I'm watching it run, there is time for me to see what has happened. Edited May 22, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 22, 2008 Share Posted May 22, 2008 NO LUCK YET----ANY HelpPost the text from the AU3Info Summary tab for the two Edit controls and the OK button. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 22, 2008 Share Posted May 22, 2008 >>>> Control <<<<Class: StaticInstance: 3ClassnameNN: Static3Try again with the mouse over the controls we are interested in (not "Static3"). Hit Ctrl+Alt+F to freeze the AU3Info window once you have the right control under the mouse. Post the ">>>> Control <<<<" section of the summary tab for each of the three target controls. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
diikee Posted May 22, 2008 Author Share Posted May 22, 2008 >>>> Control <<<< Class: Edit Instance: 2 ClassnameNN: Edit2 ID: 1003 Text: Position: 139, 176 Size: 152, 14 ControlClick Coords: 35, 5 Style: 0x54000080 ExStyle: 0x00000000 Handle: 0x009A046C >>>> Control <<<< Class: Edit Instance: 3 ClassnameNN: Edit3 ID: 1005 Text: Position: 116, 199 Size: 194, 20 ControlClick Coords: 89, 8 Style: 0x500100A0 ExStyle: 0x00000204 Handle: 0x004D0590 >>>> Control <<<< Class: Button Instance: 1 ClassnameNN: Button1 ID: 1007 Text: &Remember my password Position: 116, 230 Size: 224, 16 ControlClick Coords: 56, 8 Style: 0x50030003 ExStyle: 0x00000004 Handle: 0x0049064A >>>> Control <<<< Class: Button Instance: 2 ClassnameNN: Button2 ID: 1 Text: OK Position: 153, 288 Size: 75, 23 ControlClick Coords: 25, 13 Style: 0x50030001 ExStyle: 0x00000004 Handle: 0x004A064A >>>> Control <<<< Class: Button Instance: 3 ClassnameNN: Button3 ID: 2 Text: Cancel Position: 234, 288 Size: 75, 23 ControlClick Coords: 26, 7 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x003905A0 Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 22, 2008 Share Posted May 22, 2008 Try it with this: Opt("WinTitleMatchMode", 4) Global $sWin = "[CLASS:#32770; TITLE:Connect to 10.100.47.10]", $hWin Global $sUser = "UserName", $sPass = "PassWord" WinWait($sWin) $hWin = WinGetHandle($sWin) WinActivate($hWin) WinWaitActive($hWin) ControlFocus($hWin, "", "[CLASS:Edit; INSTANCE:2]") Sleep(500) ControlSend($hWin, "", "[CLASS:Edit; INSTANCE:2]", $sUser); Username Sleep(500) ControlFocus($hWin, "", "[CLASS:Edit; INSTANCE:3]") Sleep(500) ControlSend($hWin, "", "[CLASS:Edit; INSTANCE:3]", $sPass); Password Sleep(500) ControlClick($hWin, "", "[CLASS:Button; INSTANCE:2]"); OK Sleep(500) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 23, 2008 Share Posted May 23, 2008 No Luck, dialog window sits there waiting to be clickedDo you mean the script never leaves the WinWait(), as in it doesn't see the window? Or do you mean it sees the window, attempts the automation, but nothing happens? Did the ControlFocus/ControlSend code run at all (even if unsuccessfully)? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
diikee Posted May 23, 2008 Author Share Posted May 23, 2008 the script sits at the WinWait() I placed a msgbox before and after on pops the one before but not after Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 23, 2008 Share Posted May 23, 2008 This is the login prompt, and sits on top of the parent browser window Hmm... It's all about identifying the window, not the control operations... Try this and post the results from the SciTE console: Opt("WinTitleMatchMode", 4) $avWinList = WinList("[CLASS:#32770]") ConsoleWrite("Found " & $avWinList[0][0] & " matching windows:" & @LF) For $n = 1 To $avWinList[0][0] ConsoleWrite($n & ": " & $avWinList[$n][0] & @LF) Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
diikee Posted May 23, 2008 Author Share Posted May 23, 2008 (edited) #include <IE.au3>Opt("TrayIconDebug", 1)Opt("WinTitleMatchMode", 4)Opt("MouseCoordMode", 1)$ip = InputBox("SUITE", "Enter IP:", "")$oIE = _IECreate($ip, 0)Sleep(1000)MsgBox(0,"test", "Got Here0")--->Got here_IELinkClickByText($oIE, "settings")Sleep(1000)MsgBox(0,"test", "Got Here1")--->>Never here--->>>I clicked cancel on the login dialog$avWinList = WinList("[CLASS:#32770]")ConsoleWrite("Found " & $avWinList[0][0] & " matching windows:" & @LF)For $n = 1 To $avWinList[0][0] ConsoleWrite($n & ": " & $avWinList[$n][0] & @LF)NextMsgBox(0,"test", "Got Here2")After I click cancel on the login dialog this is what was on the console:>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\autoit\login.au3" Found 5 matching windows:1: Outlook Send/Receive Progress2: 3: Missing Virus Definitions4: Alert Message5: RaidMgr Edited May 23, 2008 by diikee Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 23, 2008 Share Posted May 23, 2008 Aha! Something is blocking the script. Both _IECreate() and _IELinkClickByText() are blocking by default. They don't return to the script until the page is done. You can override that with the f_wait = 0 parameter, but remember that means the page won't be done loading yet when the script continues. So this should work: $oIE = _IECreate($ip, 0) MsgBox(0, "test", "Got Here0") _IELinkClickByText($oIE, "settings", 0, 0); Don't wait for page to load after click MsgBox(0, "test", "Got Here1") $avWinList = WinList("[CLASS:#32770]") ConsoleWrite("Found " & $avWinList[0][0] & " matching windows:" & @LF) For $n = 1 To $avWinList[0][0] ConsoleWrite($n & ": " & $avWinList[$n][0] & @LF) Next MsgBox(0, "test", "Got Here2") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
diikee Posted May 23, 2008 Author Share Posted May 23, 2008 (edited) After running the script, this is what I got on the console>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\autoit\login.au3" Found 6 matching windows:1: Connect to 10.100.47.32: Outlook Send/Receive Progress3: 4: Missing Virus Definitions5: Alert Message6: RaidMgr+>13:29:17 AutoIT3.exe ended.rc:0>Exit code: 0 Time: 18.479so, now I need to implement this on my script and I will be good... Edited May 23, 2008 by diikee Link to comment Share on other sites More sharing options...
diikee Posted May 23, 2008 Author Share Posted May 23, 2008 Got it Working with the following script:$oIE = _IECreate($ip, 0)MsgBox(0, "test", "Got Here0")_IELinkClickByText($oIE, "settings", 0, 0); Don't wait for page to load after clickMsgBox(0, "test", "Got Here1")$avWinList = WinList("[CLASS:#32770]");$avWinList = WinList("[title:Connect to ]"& $ip)ConsoleWrite("Found " & $avWinList[0][0] & " matching windows:" & @LF)For $n = 1 To $avWinList[0][0] ConsoleWrite($n & ": " & $avWinList[$n][0] & @LF) If String($avWinList[$n][0]) = "Connect to " & $ip Then ControlClick("Connect to " & $ip, "", "[CLASS:Button; INSTANCE:2]") EndIf NextMsgBox(0, "test", "Got Here3")Thanks For ALL Your help and Patience. We need more people like you Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 23, 2008 Share Posted May 23, 2008 Glad you got it working. Have a great holiday weekend! (If you're in the US, anyway...) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now