Jump to content

_IEAttach No Match Found.


Recommended Posts

Hello!

I'm writing some code that requires the program to wait until a specific internet explorer window is created and attaches to it. Then waits until is closed and triggers some more code. The problem is that while winexists works, I cannot get _IEAttach to work as it always says $_IESTATUS_NoMatch. I have ttied using ie attach with window title, title, and url.

global $cWindow = ""
global $wLoop = 1

while 1
   _wSearch()
   sleep(100)
WEnd

func _wSearch()
if $wLoop = 1 then
   if winexists("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer") Then
      $cWidnow = _ieattach("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer","windowtitle")
      $wLoop = 0
      msgbox(0,"TEST","Pt window found") 
   EndIf
Else
   if winexists($cWindow) then
      sleep(100)
   Else
      ;tooltip change
      $wLoop = 1
      msgbox(0,"test","Pt window closed")
   EndIf
endif
EndFunc

using autoit tool I confirm that the window title is correct:

>>>> Window <<<<
Title:    PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer
Class:    IEFrame
Position:    193, 116
Size:    1667, 891
Style:    0x16CF0000
ExStyle:    0x00000100
Handle:    0x0000000000110B88
 

What am I missing here?

Link to comment
Share on other sites

There is a bug in there.  If you open IE.au3 you will see that it must end with either 

If StringInStr($oWindow.document.title & " - Microsoft Internet Explorer", $sString) Then $bFound = True
                        If StringInStr($oWindow.document.title & " - Windows Internet Explorer", $sString) Then $bFound = True

But not - Internet Explorer.

So if it was to work you shouldn't provide the last part...(untested)

Edit : tested just remove "- Internet Explorer" of the title and it works !

Edited by Nine
Link to comment
Share on other sites

14 hours ago, Nine said:

There is a bug in there.  If you open IE.au3 you will see that it must end with either 

If StringInStr($oWindow.document.title & " - Microsoft Internet Explorer", $sString) Then $bFound = True
                        If StringInStr($oWindow.document.title & " - Windows Internet Explorer", $sString) Then $bFound = True

But not - Internet Explorer.

So if it was to work you shouldn't provide the last part...(untested)

Edit : tested just remove "- Internet Explorer" of the title and it works !

This is very strange, I just tried it and although it no longer throws a no match error when doing ie attach, the object i get doesn't seem to be a ie object for the window. If I use navigate on $cWindow it says $_IESTATUS_InvalidDataType . I still think it's attaching incorrectly.  There is no @error returned. But if I just do a message box  for $cwindow its empty.

 

Even mmore strange is if i use

      Local $hWnd = WinGetHandle("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer", "")
      and then do WinClose($hWnd) it will close the window.

But then if i do $cWidnow = _ieattach($hWnd,"hwnd") it Still doesn't get an internet explorer object.

 

Edited by ComradVlad
Link to comment
Share on other sites

20 minutes ago, ComradVlad said:

... But if I just do a message box  for $cwindow its empty.

How do you message box for $cwindow ?

you should use like this to check if $cwindow  is an (IE) object:

MsgBox(0, 'check', IsObj($cwindow))

and you should get '1' if OK or '0' if KO

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

32 minutes ago, Chimp said:

How do you message box for $cwindow ?

you should use like this to check if $cwindow  is an (IE) object:

MsgBox(0, 'check', IsObj($cwindow))

and you should get '1' if OK or '0' if KO

here is the code i just tried

global $cWindow
global $wHandle
global $wLoop = 1

while 1
   _wSearch()
   sleep(100)
WEnd

func _wSearch()
if $wLoop = 1 then
   if winexists("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer") Then
      $wHandle = WinGetHandle("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer", "")
      $cWidnow = _ieattach($wHandle,"hwnd")
      _ienavigate($cWindow,"google.com")
      $wLoop = 0
      MsgBox(0, 'check', IsObj($cwindow))
   EndIf
Else
   if winexists($wHandle) then
      winclose($wHandle)
      msgbox(0,"test","closing window")
      sleep(100)
   Else
      ;tooltip change
      $wLoop = 1
      msgbox(0,"test","Pt window closed")
   EndIf
endif
EndFunc

The message box returns 0. Also the other weird behavior i found is as follows. There is one internet explorer window with a list of links. Links that lead to different pages titled "PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer"  when clicking on one link it opens a second titled as stated. If I start the program before I click the link it runs and doesn't find the PT window (as it shouldn't) but after I open the window it DOES find it using wingethandle and closes it, then the loop restarts and then it closes the initial window with the list even though its title isn't "PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer". I'm thoroughly confused at this point.

Link to comment
Share on other sites

Ok let start with the basic.  Close every instance of IE.  Start a single IE with PHYSICAL.... page. Run those three lines.

Local $wHandle = WinGetHandle("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer", "")
Local $cWidnow = _ieattach($wHandle,"hwnd")
MsgBox(0, 'check', $wHandle & "/" & IsObj($cwindow))

What do you obtain ?

Edited by Nine
Link to comment
Share on other sites

15 minutes ago, Nine said:

Ok let start with the basic.  Close every instance of IE.  Start a single IE with PHYSICAL.... page. Run those three lines.

Local $wHandle = WinGetHandle("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer", "")
Local $cWidnow = _ieattach($wHandle,"hwnd")
MsgBox(0, 'check', $wHandle & "/" & IsObj($cwindow))

What do you obtain ?

result in attached picture.

 

Also the winclose thing happens if the PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY window is actually opened in a tab instead of a separate window. If  its opened in a separate window than the parent window doesn't get closed.

 

result.jpg

Edited by ComradVlad
other image
Link to comment
Share on other sites

3 hours ago, Chimp said:

him gets an handle in $wHandle but it gets 0 for the IsObj($cwindow)

So i just tried example #5 from https://www.autoitscript.com/autoit3/docs/libfunctions/_IEAttach.htm

 

; Create an array of object references to all current browser instances
; The first array element will contain the number of instances found

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $aIE[1]
$aIE[0] = 0

Local $i = 1, $oIE
While 1
    $oIE = _IEAttach("", "instance", $i)
    If @error = $_IEStatus_NoMatch Then ExitLoop
    ReDim $aIE[$i + 1]
    $aIE[$i] = $oIE
    $aIE[0] = $i
    $i += 1
WEnd

MsgBox($MB_SYSTEMMODAL, "Browsers Found", "Number of browser instances in the array: " & $aIE[0])

and it throws a $_IESTATUS_NoMatch warning on ieattach as well even though it counts the amount on internet explorer instances correctly. So it's not my code but something else. Any ideas?

Link to comment
Share on other sites

9 minutes ago, Danp2 said:

You stated in a prior thread that Windows Defender was the cause of an IE navigation issue. Have you tried temporarily disabling it to ensure it isn't interfering here?

yup I did that as well, disabled code execution prevention, disabled live security, all that. It was the first thing i tried after my last run in with _IE issues.

 

And just tried running the code on a different machine, windows 8.1 ie 11 same deal.

Edited by ComradVlad
Link to comment
Share on other sites

welp, im officially embarrassed. 

 

if $wLoop = 1 then
   if winexists("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer") Then
      $wHandle = WinGetHandle("PHYSICAL THERAPY DISCHARGE/ TRANSFER SUMMARY - Internet Explorer", "")
      $cWidnow = _ieattach($wHandle,"hwnd")
      _ienavigate($cWindow,"google.com")
      $wLoop = 0
      MsgBox(0, 'check', IsObj($cwindow))
   EndIf
   
   $cWidnow = _ieattach($wHandle,"hwnd")
   
    $cWidnow

$cWidnow

I'm going to go sit in the shame corner now. Thanks for your time guys. 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...