imacleod Posted November 24, 2015 Posted November 24, 2015 To narrow that down a bit, I have a script that used to work under IE8, we recently moved to IE11 and the script now gets so far, and then does not work; it seems to be related to the WinGetTitle. The first portion - where it posts a text into a field and clicks on the button which redraws the page - works, but Global $sWinTitle = WinGetTitle($hWnd) seems to fail as the debug before the Case statement below always reveals no value.While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop Local $aCDSIDs = StringSplit($line, $DELIM) For $i = 1 To $aCDSIDs[0] ;Wait until the tab titled 'SIVA LIST page' exists WinWait("SIVA LIST page") ;attach to the TAB with 'SIVA LIST page' as title Local $oIE = _IEAttach("SIVA LIST page") ;Get a handle for the window, indedependent of the title Global $hWnd = WinGetHandle("SIVA LIST page") ;"ACQUSER" is the name of the CDSID input box, get a reference for it Local $oText = _IEGetObjByName($oIE, "ACQUSER") ; Assign input focus to the field and then send the text string _IEAction($oText, "focus") _IEFormElementSetValue($oText, $aCDSIDs[$i]) ;"ACQUIRE" is the name of the "Update" button, get a reference for it Local $oUpdate = _IEGetObjByName($oIE, "ACQUIRE") _IEAction($oUpdate, "click") ;Page is redrawn, select action based on window titles While 1 WinWaitNotActive("SIVA LIST page") Global $sWinTitle = WinGetTitle($hWnd) MsgBox($MB_SYSTEMMODAL, "Debug", "$sWinTitle is set to ", $sWinTitle) Select Case $sWinTitle = ...Any pointers?
JohnOne Posted November 24, 2015 Posted November 24, 2015 Try$hWnd = _IEPropertyGet($oIE, "hwnd")Also, I would not advise to declare scope (Global or Local) in a loop, it wont break your script, but it's not usual protocol. imacleod 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
imacleod Posted November 25, 2015 Author Posted November 25, 2015 Thanks John; not sure what happened to the notification email I should have got for your reply.Yes, that works, and it shows me that the window/browser title has been added to when we moved to IE11; something that's not visible in the browser itself as it's quite longwinded.
imacleod Posted December 10, 2015 Author Posted December 10, 2015 Though there was some progress - that allowed the bulk of records to be processed - I'm still having issues with the next line of code that followed on from the case statement above: Case $sWinTitle = "**********************" $oIEextend = _IEAttach($hWnd) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hWnd = ' & $hWnd & ' >Return code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console That produces the following in the console:--> IE.au3 T3.0-1 Warning from function _IEAttach, $_IESTATUS_NoMatch@@ Debug(104) : $hWnd = 0x0052050E >Return code: 7 Extended code: 0x00000001Is that saying it can't match the window it seems to have a handle for?
JohnOne Posted December 10, 2015 Posted December 10, 2015 Help file should really be your first stop, always look at it with each function you use.$oIEextend = _IEAttach($hWnd, "hwnd") imacleod 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
imacleod Posted December 10, 2015 Author Posted December 10, 2015 Thanks,Sorry to be such a noob; I did look, but didn't see.
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