Jump to content

How to collect a list of searching result?


oemript
 Share

Recommended Posts

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^)

 

 

Google3.png

Link to comment
Share on other sites

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

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^)

 

 

IEbyXPath.png

Edited by oemript
Link to comment
Share on other sites

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)

 

Link to comment
Share on other sites

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^)

 

 

Google7.png

Edited by oemript
Link to comment
Share on other sites

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

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 by oemript
Link to comment
Share on other sites

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

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)

Attach1.png

Edited by oemript
Link to comment
Share on other sites

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

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 by oemript
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...