Jump to content

_IEGetObjByID in a While

Recommended Posts



google can't help me, so i've created an account and hopefully some of u can help me with my code.


My code should overwatch a status div (well, it is a span, but with id) in IE, while it is changing during the game. It is working, but it'll go on error in a few rounds.

While 1

   $oIE = _IEAttach("Game")

   Local $oDiv = _IEGetObjById($oIE, "banner")
   Local $array = _StringExplode($oDiv.innertext, " ", 0)

   If($array[0] = "State 1") Then
      ToolTip("State 1")
   ElseIf($array[0] = "State 2") Then
      ToolTip("State 2")
   ElseIf($array[0] = "State 3") Then
      ToolTip("State 3")
   ElseIf($array[0] = "State 4") Then
      ToolTip("State 4")

So this is roughly the code, where my error will occur. After 1-5 Rounds it will get me to this:


"C:\..." (37) : ==> Variable must be of type "Object".:
Local $array = _StringExplode($oDiv.innertext, " ", 0)
Local $array = _StringExplode($oDiv^ ERROR


So it seems that _IEGetObjByID will sometimes get a false, so that _StringExplode cant explode the Object into the array.


Tried many things:

- Put the IEAttach over the While

- Tried to If IsObj on various positions in the code


but none of them will work for me. Only when i will put up the sleep-timer, the code will work longer, but i'll reach a timing, where some states wont be recognized.


Some Answers, before someone would ask:

- I Use Attach, because this Game has a complicated Login System over another platform, then will need me to type in a security code, so i want to start ie with the game, login and then hit "go"

- i need the game states to recognize, what i have to do in the next round

- yes i got the whole error handle thing imported, but that wont help out for now, i descriped the error


Hopefully u can suggest me a solution or maybe another method to do this. Cant go for PixelGetColor, because the state will only be signalized in text form in a span.


Thanks !

Share this post

Link to post
Share on other sites


Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game interaction - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites
This topic is now closed to further replies.


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.