ComradVlad Posted October 28, 2019 Share Posted October 28, 2019 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 More sharing options...
Nine Posted October 29, 2019 Share Posted October 29, 2019 (edited) 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 October 29, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 (edited) 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 October 29, 2019 by ComradVlad Link to comment Share on other sites More sharing options...
Gianni Posted October 29, 2019 Share Posted October 29, 2019 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 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 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 More sharing options...
Nine Posted October 29, 2019 Share Posted October 29, 2019 (edited) 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 October 29, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 (edited) 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. Edited October 29, 2019 by ComradVlad other image Link to comment Share on other sites More sharing options...
Nine Posted October 29, 2019 Share Posted October 29, 2019 i don't see picture, just tell me what you have... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Gianni Posted October 29, 2019 Share Posted October 29, 2019 him gets an handle in $wHandle but it gets 0 for the IsObj($cwindow) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Nine Posted October 29, 2019 Share Posted October 29, 2019 IE doesn't work with Edge... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted October 29, 2019 Share Posted October 29, 2019 @Nine There's also a typo in the code you posted ($cWidnow <> $cwindow) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted October 29, 2019 Share Posted October 29, 2019 1 minute ago, Danp2 said: @Nine There's also a typo in the code you posted ($cWidnow <> $cwindow) True “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 1 hour ago, Nine said: IE doesn't work with Edge... its not Edge its IE 11 on windows 10 Link to comment Share on other sites More sharing options...
Nine Posted October 29, 2019 Share Posted October 29, 2019 Idk, it is working for me using google.com on win7 and win10 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 1 minute ago, Nine said: Idk, it is working for me using google.com on win7 and win10 Ok, thanks for trying to help. Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 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 More sharing options...
Danp2 Posted October 29, 2019 Share Posted October 29, 2019 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? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 (edited) 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 October 29, 2019 by ComradVlad Link to comment Share on other sites More sharing options...
ComradVlad Posted October 29, 2019 Author Share Posted October 29, 2019 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 More sharing options...
Gianni Posted October 29, 2019 Share Posted October 29, 2019 you're not the only one ... there's even worse... https://abovethelaw.com/2018/01/the-most-embarrassing-typo-in-a-lawyer-letter-ever/?rf=1 https://www.amazon.com/Just-My-Typo-Sinning-Untied/dp/0385346603#reader_0385346603 ComradVlad 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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