Jump to content

Error: Variable must be of type "Object"


Recommended Posts

$a_b = _IEAttach("Untitled Document")
$a_sMyString = "caught"
$a_oLinks = _IELinkGetCollection($a_b)
For $a_oLink in $a_oLinks
    $a_sLinkText = _IEPropertyGet($a_oLink, "innerText")
    If StringInStr($a_sLinkText, $a_sMyString) Then
        Sleep(Random(200000, 220000)
    EndIf
Next

I get the error:

For $a_oLink in $a_oLinks

For $a_oLink in $a_oLinks^ ERROR

Error: Variable must be of type "Object".

Why?

Edited by c4mpi
Link to comment
Share on other sites

What motivated you to reply?

what motivated me to read this?

(i don't even know what that code is supposed to do)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

@c4mpi

I think i tolded you on some your previous topic that _IEAttach wokrs with IE

I see heare that your trying to attach to ("Untitled Document") and noone have slightest idea is that some tupe of page, document or program. So we need more info.

I can tell that you probably have on your script 3 errors

First is, probably _IEAttach("Untitled Document")

Second is, no "If @error Then" on _IELinkGetCollection func

And the third is, "Sleep(Random(200000, 220000)" shud b "Sleep(Random(200000, 220000))"

#include <IE.au3> 
_IECreate("http://www.google.com/search?hl=sr&rls=com.microsoft%3Asr&q=caught&btnG=%D0%9F%D1%80%D0%B5%D1%82%D1%80%D0%B0%D0%B6%D0%B8&lr=&aq=null&oq=")
$a_b = _IEAttach("caught - Google")
$a_sMyString = "caught"
$a_oLinks = _IELinkGetCollection($a_b)
If @error Then
    MsgBox(0,"","ERROR")
Else
    For $a_oLink in $a_oLinks
        $a_sLinkText = _IEPropertyGet($a_oLink, "innerText")
        If StringInStr($a_sLinkText, $a_sMyString) Then
            MsgBox(0,"Gona Go Sleep Noy","Cy"&@CRLF&"ZZzzZzzZZZZzzzzzzZzzz")
            Sleep(Random(200000, 220000))
        EndIf
    Next
EndIf
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

So $a_oLinks is not the collection you expected it to be. Add _IEErrorHandlerRegister() to the top of your script and run it in SciTE to get more diagnostic information. Also test @error after _IELinkGetCollection() before trying to use the collection.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...