Jump to content

Error from function _IEPropertyGet


Jerrif
 Share

Recommended Posts

Hi,

I'm busy trying to write a script that creates a GUI where the user can select a bunch of programs to launch. That part's easy enough, although I also want the GUI to display a few other things. I've managed to get 2 more child GUIs to pop up with images using InetGet(), but I'm struggling with retrieving text from _IECreate(), and at the same time keeping the GUI active. My solution looks pretty inelegant to me, but I can't think of any better way to do it:

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

$server1URL = "http://www.gametracker.com/server_info/113.212.96.249:16567/"

$curServer = ""

ragamuffin()

Func GUIloopy() ;This is where the GUI loop goes
While 1
    If _IEPropertyGet($curServer, "busy") = False Then
        ConsoleWrite("Done")
        ExitLoop
    EndIf
WEnd
EndFunc

_IEQuit($curServer)

Func ragamuffin()
    $curServer = _IECreate($server1URL, 0, 0, 1)
    Do
        loopy()
    Until _IEPropertyGet($curServer, "busy") = False

    $curReadText = _IEBodyReadText($curServer)
    $currentMapLame = _StringBetween($curReadText, "CURRENT MAP ", "Is")
    $currentMap = $currentMapLame[0]
    $currentMap = StringStripWS($currentMap,7)
    MsgBox(0, "blah", $currentMap)
    _IEQuit($curServer)

EndFunc

Now, this code works fine for me in my main script, but I can't help but notice that it gives me the error:

--> IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidDataType

Seemingly every time it loops the GUI.

Anyway, the script works just fine, I was just wondering if I should be concerned about the (orange) error, or just ignore it?

Also, is that a stupid way of keeping the GUI 'active'? Is there a better way I could do it?

Link to comment
Share on other sites

Just sloppy coding. $curServer is only defined in the context of your ragamuffin function and is undefined (thus invalid data typr) in the loopy function. Declare it as a global or pass its value as a parameter to the function.

You can easily debug by testing the content of the variable where the error occurs.

No comments on the functionality of your code, just the _IE error.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Just sloppy coding. $curServer is only defined in the context of your ragamuffin function and is undefined (thus invalid data typr) in the loopy function. Declare it as a global or pass its value as a parameter to the function.

Ahh, I see now! Thank you very much Dale!

Unfortunately, sloppy coding is all I know how to do, but I like to think that with every mistake I'm at least learning something (although the concept of variable scope went way over my head when my brother tried explaining it to me :D )

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