oemript Posted February 26, 2018 Author Share Posted February 26, 2018 Hi jdelaney: Could you please take a look at the IEbyXPath.au3? which require following files. #include <ie.au3> #include <array.au3> An error occurs during executing this file as shown below image, would it be caused by missing above files? if yes, could you please provide any link on where to download those files? Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
oemript Posted February 26, 2018 Author Share Posted February 26, 2018 Hi jdelaney: Do you see my post? Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Subz Posted February 26, 2018 Share Posted February 26, 2018 Can you test through Scite using F5, that way you can see where the error is coming from. Link to comment Share on other sites More sharing options...
oemript Posted February 27, 2018 Author Share Posted February 27, 2018 Please see following image: Do you have any suggestions on what wrong it is? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2018 Share Posted February 27, 2018 For some reason you're still using sbqs_c, yet your previous snapshots show sbsb_b. Link to comment Share on other sites More sharing options...
oemript Posted February 27, 2018 Author Share Posted February 27, 2018 5 hours ago, Subz said: For some reason you're still using sbqs_c, yet your previous snapshots show sbsb_b. Based on your post #19, I use exactly your code, and cannot find "sbsb_b" on coding. Could you please tell me on which post number show "sbsb_b"? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2018 Share Posted February 27, 2018 Your screenshot on Post 9 Link to comment Share on other sites More sharing options...
oemript Posted February 27, 2018 Author Share Posted February 27, 2018 (edited) Page source cannot be confirmed on post 9, it should based on Jdelaney's coding on post 2, because it can actually local and input "test" on input box. Furthermore, please see following image, when I run original IEbyXPath.au3 with no editing, it still pop up with error as shown below: Can you test Jdelaney's orignial coding? and do you see the same error as I mention? Would it be possible to look into the error variable and see what is contained for debug purpose? Does AutoIT have this debug feature? Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited February 27, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2018 Share Posted February 27, 2018 Don't know, it works fine on my system, both Google sample I posted and @jdelaney sample. Can you test if the following works for you? #include <IE.au3> Local $oIE = _IECreate("https://www.google.co.nz") Local $oInput = _IEGetObjByName($oIE, "q") $oInput.Value = "k" MsgBox(0, "Google Search", "Google Search Filed Updated.", 1) ;~ For some reason IE needs to lose focus before being able to get access to ListBox items Local $oListBoxs = _IETagNameGetCollection($oIE, "ul") Local $sSearch = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("role") = "listbox" Then $oListItems = _IETagNameGetCollection($oListBox, "div") For $oListItem In $oListItems If $oListItem.getAttribute("role") = "option" Then If $oListItem.GetAttribute("role") = "option" Then $sSearch &= StringStripWS($oListItem.Innertext, 7) & @CRLF EndIf Next EndIf Next MsgBox(32, "Search Items", $sSearch) oemript 1 Link to comment Share on other sites More sharing options...
oemript Posted February 27, 2018 Author Share Posted February 27, 2018 (edited) 4 hours ago, Subz said: #include <IE.au3> Local $oIE = _IECreate("https://www.google.co.nz") Local $oInput = _IEGetObjByName($oIE, "q") $oInput.Value = "k" MsgBox(0, "Google Search", "Google Search Filed Updated.", 1) ;~ For some reason IE needs to lose focus before being able to get access to ListBox items Local $oListBoxs = _IETagNameGetCollection($oIE, "ul") Local $sSearch = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("role") = "listbox" Then $oListItems = _IETagNameGetCollection($oListBox, "div") For $oListItem In $oListItems If $oListItem.getAttribute("role") = "option" Then If $oListItem.GetAttribute("role") = "option" Then $sSearch &= StringStripWS($oListItem.Innertext, 7) & @CRLF EndIf Next EndIf Next MsgBox(32, "Search Items", $sSearch) This one works from my computer, and would like to know on how to output those search items into C:\samples.txt file and close 2 browsers' window as well. Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited February 27, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2018 Share Posted February 27, 2018 That's the most basic part, of the script, I would prefer you attempt to code it otherwise you'll never learn. Hint - look at FileOpen, FileWrite and FileClose. To close browser windows look at the _IE functions in the helpfile. Link to comment Share on other sites More sharing options...
oemript Posted February 28, 2018 Author Share Posted February 28, 2018 After running following coding, Sample.txt file contains nothing, Local Const $sFilePath = "D:\Sample.txt" MsgBox(32, "Search Items", $sSearch ) Sleep(3000) Local $hFileOpen = FileOpen($sFilePath, $FO_READ + $FO_OVERWRITE) FileWrite($sFileOpen, $sSearch& @CRLF) FileClose($sFileOpen) Do you have any suggestions on what wrong it is? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Subz Posted February 28, 2018 Share Posted February 28, 2018 Try: Local $hFileOpen = FileOpen("D:\Sample.txt", 2) FileWrite($hFileOpen, $sSearch & @CRLF) FileClose($hFileOpen) oemript 1 Link to comment Share on other sites More sharing options...
oemript Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) I am very appreciated for all your help For closing opened browser, what kind of keywords should be searched under help? Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited February 28, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted February 28, 2018 Share Posted February 28, 2018 _IEQuit(), if you didn't open the Window with a script you can use _IEAttach to get the object and then use _IEQuit Link to comment Share on other sites More sharing options...
oemript Posted February 28, 2018 Author Share Posted February 28, 2018 I have tried following samples, and receive no response on closing IE and MsgBox Do you have any suggestions on what wrong it is? Thanks, to everyone very much for any suggestions (^v^) Sample 1 _IEQuit($oIE) _IEQuit($oIE1) Sample 2 ; 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]) Link to comment Share on other sites More sharing options...
oemript Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) 3 hours ago, Subz said: _IEQuit(), if you didn't open the Window with a script you can use _IEAttach to get the object and then use _IEQuit When I try following sample coding, it cannot close IE window too. Please see following image as shown below Do you have any suggestions on what wrong it is? Thanks, to everyone very much for any suggestions (^v^) ======================================================================================== ; Attach to a browser with "AutoIt" in its title, display the URL #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("www.autoitscript.com") Local $oIE1 = _IECreate("www.google.com") $oIE = _IEAttach("AutoIt") MsgBox($MB_SYSTEMMODAL, "The URL", _IEPropertyGet($oIE, "locationurl")) _IEQuit($oIE) _IEQuit($oIE1) Edited February 28, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted February 28, 2018 Share Posted February 28, 2018 Strange after I press OK on the MsgBox both windows close correctly, what is the error codes: #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("www.autoitscript.com") Local $oIE1 = _IECreate("www.google.com") $oIE = _IEAttach("AutoIt") MsgBox($MB_SYSTEMMODAL, "The URL", _IEPropertyGet($oIE, "locationurl")) _IEQuit($oIE) MsgBox(32, "Return Value", "_IEQuit($oIE) Returned: " & @error) _IEQuit($oIE1) MsgBox(32, "Return Value", "_IEQuit($oIE1) Returned: " & @error) Link to comment Share on other sites More sharing options...
oemript Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) Both return 0 values, It works now when I remove MsgBox message. ;MsgBox(32, "Search Items", $sSearch ) Do you have any suggestions on how to close the MsgBox as well? Thanks, to everyone very much for any suggestions (^v^) Edited February 28, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted February 28, 2018 Share Posted February 28, 2018 Just remove the MsgBox, it's not required, it was only to show how to use _IEPropertyGet i.e. #include <IE.au3> Local $oIE = _IECreate("www.autoitscript.com") Local $oIE1 = _IECreate("www.google.com") $oIE = _IEAttach("AutoIt") _IEQuit($oIE) _IEQuit($oIE1) 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