Jump to content

_IEGetObjByID in a While


Recommended Posts

Heya,

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

   sleep(500)
   $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")
   EndIf
WEnd

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 !

Link to comment
Share on other sites

  • Moderators

chrisyy,

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.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...