Jump to content

Setting Image Problem


Recommended Posts

I have a script that searches an external app for names that it gets from an .ini file.

If my .ini looks like this:

[BuddyList]
Buddies=word0,word1

Then it would first search for word0 in the external app and if his status is online it would set a certain image.

If he was offline it would set another image.

Now, the problem I'm having is if the first buddy is offline but the second buddy is online it will set the online image to both buddies. What's my problem?

For $i = 1 To $buddiesSearch[0]
                            ControlSetText("Find Player", "", "Edit1", "")
                            Sleep(500)
                            ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player
                            Sleep(500)
                            $buddyname = ControlGetText("Find Player", "", 1001)
                            Sleep(500)
                            ControlClick("Find Player", "", 261); clicks remove player button
                            $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" )
                        Next
                            $count = _GUICtrlListCount($ListBox)
                            If $count < 1 Then $count = 1; correct count so our For loop goes one time, no matter user is off/online
                        For $a = 0 To $count - 1
                            $text = _GUICtrlListGetText($ListBox, $a); Gets the tables/items
                            If $text = -1 Then
                                $text = "Offline"
                            Else
                            EndIf
                            $text = StringReplace($text, "-", "|")
                            $Online = _GUICtrlListCount($ListBox)
                            If $Online > 0 Then; If buddy is online then set online image and ini write
                                INIWrite("C:\buddies.ini", "OnlineBuddies", $buddyname, IniRead("C:\buddies.ini", "OnlineBuddies", $buddyname, "") & $text & ","); Writes the buddy's name and table to the ini
                                GUICtrlSetImage($nListview, "shell32.dll", -138)
                            Else; If he's offline set offline image
                                GUICtrlSetImage($items, "shell32.dll", -110)
                            EndIf
                            ControlSetText("Find Player", "", "Edit1", "")
                        Next
While Alive() {
	 DrinkWine();
}
AutoIt Programmer
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...