Jump to content

WinGetTitle; what's changed in IE11?

Recommended Posts

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)
                  Case $sWinTitle = ...

Any pointers?

Share this post

Link to post
Share on other sites


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

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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: 0x00000001

Is that saying it can't match the window it seems to have a handle for?


Share this post

Link to post
Share on other sites

Help file should really be your first stop, always look at it with each function you use.

$oIEextend = _IEAttach($hWnd, "hwnd")

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

  • Create New...