Jump to content
ChipConnJohn

Can't figure out errors using _IE object

Recommended Posts

ChipConnJohn

Hello all,

I'm trying to create a webscrape script using AutoIt.  A non-profit I'm involved with is using GroupSpaces.com and there is no notification to the group when someone posts a new topic to the forum.  I'm including IE.au3


#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <String.au3>

; Open Groupspaces.com
Global $oIE = _IECreate ("http://www.groupspaces.com")

_IENavigate($oIE,"http://groupspaces.com/MyCrazyTest/forum/")

;Grab all the links on the Forum page
Global $oLinksCategoryPage = _IELinkGetCollection($oIE)

For $oLink In $oLinksCategoryPage
    Local $oLinkHRef = $oLink.href
    If StringInStr($oLinkHRef,"forum_id") Then
        ;This is a category. Click into it.
        _IENavigate($oIE,$oLinkHRef)
Sleep(3)
        ;Back out to Category List
        _IEAction($oIE,"back")
    EndIf
Next
_IEQuit($oIE)

Share this post


Link to post
Share on other sites
Subz

Place the links into an Array and then go through them this way for example:

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

; Open Groupspaces.com
Global $oIE = _IECreate ("http://www.groupspaces.com")

_IENavigate($oIE,"http://groupspaces.com/MyCrazyTest/forum/")

;Grab all the links on the Forum page
Global $oLinksCategoryPage = _IELinkGetCollection($oIE)
Global $aLinksCategoryPage[0]
Global $oLinkHRef
For $oLink In $oLinksCategoryPage
    $oLinkHRef = $oLink.href
    If StringInStr($oLinkHRef,"forum_id") Then _ArrayAdd($aLinksCategoryPage, $oLinkHRef)
Next

For $i = 0 To UBound($aLinksCategoryPage) - 1
    _IENavigate($oIE, $aLinksCategoryPage[$i])
Next

 

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

  • Similar Content

    • vati1011
      By vati1011
      Hey, guys.
      Currently, I'm using Opencv UDF and i'm  encountering issues with DLLOPEN(). it is failing and returning -1
      But, I cannot figure out why it is failing.
      I need help from people.
      I'm running windows 10 32bit.
      This's my code.
      #RequireAdmin $fileopen = DllOpen("opencv_core2413.dll") MsgBox(0,"Result",$fileopen) Example.au3opencv_core2413.dll
    • faustf
      By faustf
      hi guys how is possible set a speed of  all function _Ie ?? 
    • xiantez
      By xiantez
      This script used to work on an older version of AutoIT. Currently I am running AutoIT v3.3.14.5 and it's failing.
      Func PublicIP() ;Post public facing IP address Local $url = 'https://www.google.com/search?client=opera&q=what+is+my+ip&sourceid=opera&ie=UTF-8&oe=UTF-8' Local $getIPaddress = BinaryToString(InetRead($url)) Local $sStart = 'clamp:2">' Local $sEnd = '</div>' Local $ipaddress = _StringBetween($getIPaddress, $sStart, $sEnd For $i In $ipaddress MsgBox(0, 'External IP', "Your public IP address is " & $i) Next EndFunc ;==>PublicIP The console output shows:
      "C:\Users\user\Documents\AutoIT\Scripts\WSI Tools.au3" (197) : ==> Variable must be of type "Object".: For $i In $ipaddress For $i In $ipaddress^ ERROR ->14:12:16 AutoIt3.exe ended.rc:1 +>14:12:16 AutoIt3Wrapper Finished. >Exit code: 1 Time: 9.811
    • Xandy
      By Xandy
      I'm listing the error message strings, and roughly matching the error code
      Is this how to do error reporting?  Is there a more simple way I don't know about?
      I realise I might not need to trap @error inside $error.  I like it this way b/c I have no fear of overwriting @error now; I don't even use it.
      Func Send_Connect($address, $port)     $socket = TCPConnect($address, $port)     $error = @error     If $error <> 0 Then         Local $aError[4] = ["-2 not connected.", _                             "1 IPAddr is incorrect.", _                             "2 port is incorrect."]         $aError[3] = "10060 Connection timed out."         If $error < 0 Then $error = 0         If $error > 2 Then $error = 3         MsgBox(0, "TCP Connect Error", $aError[$error], 0)         $socket = 0     EndIf     Return $socket EndFunc
    • Spartan117
      By Spartan117
      Hi everyone,
      I am wondering if is there any autoit function that make the program ignore errors and move on and resume correct lines?
      Thank you
×