Jochem Posted February 24, 2009 Posted February 24, 2009 I want to create a tool tip for many pictures, but my script isn't working $folder = "\\server\log\" $arrayuse = _FileListToArray($folder, "*") #Region ### START Koda GUI section ### Form=C:\Data\au\computer issues\adobe\1computer.kxf $adobe_1_1 = GUICreate("search adobe", 259, 66, 550, 213) $picc88 = GUICtrlCreatePic("imac_free.jpg", 20, 10, 30, 30) $picc90 = GUICtrlCreatePic("imac_free.jpg", 50, 10, 30, 30) $picc91 = GUICtrlCreatePic("imac_free.jpg", 80, 10, 30, 30) $picc92 = GUICtrlCreatePic("imac_free.jpg", 110, 10, 30, 30) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") For $i = $arrayuse[1] To $arrayuse Step 1 $i2 = StringTrimLeft(StringTrimRight($i, 4), 3) GUICtrlSetTip(Eval("$pic" & $i2), "test") Next While 1 Sleep(10) WEnd Func CLOSEClicked() Exit EndFunc the value of a string in the arrayuse is i.e. ws-c91.log Thats why I am trimming the left and right side. I checked already the value $i2 with a messagebox (it gives indeed c91).
exodius Posted February 24, 2009 Posted February 24, 2009 (edited) From the Help File for _FileListToArray: The array returned is one-dimensional and is made up as follows: $array[0] = Number of Files\Folders returned $array[1] = 1st File\Folder $array[2] = 2nd File\Folder $array[3] = 3rd File\Folder $array[n] = nth File\Folder In your For...Next loop you don't reference the [0] index as the amount to go to. *Edit - For that matter, there's a lot wrong with the opening line of your For...Next statement. Try this instead: For $i = 1 To $arrayuse[0] Edited February 24, 2009 by exodius
Jochem Posted February 24, 2009 Author Posted February 24, 2009 *Edit - For that matter, there's a lot wrong with the opening line of your For...Next statement. Try this instead: For $i = 1 To $arrayuse[0] but that is giving me one blank line, but oke a changed it like this: For $i = 1 To $arrayuse Step 1 $i2 = StringTrimLeft(StringTrimRight($i, 4), 3) MsgBox(0,"",$i2) GUICtrlSetTip(Eval("$pic" & $i2), "test") Next the message box is just a control. I think the eval is not working like this.
Authenticity Posted February 24, 2009 Posted February 24, 2009 Remove the dollar sign in the Eval call, call it like this: Eval('pic' & $i2)
Jochem Posted February 24, 2009 Author Posted February 24, 2009 Remove the dollar sign in the Eval call, call it like this: Eval('pic' & $i2) YES!! thanks, this worked.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now