Jump to content

For Statement


Recommended Posts

Are you sure your ini was correct?

This seemed to work:

This is what I made the INI:

[Pic]
0="C:\Documents and Settings\Images\Radio.bmp"
1="C:\Documents and Settings\Images\Radio1.bmp"
2="C:\Documents and Settings\Images\Radio2.bmp"
3="C:\Documents and Settings\Images\Radio3.bmp"
4="C:\Documents and Settings\Images\Radio4.bmp"

And this is the code:

for $i = 0 to 4
    Assign ('read' & $i, IniRead(@ScriptDir & "\Radio.ini", "Pic", $i, ""), "")
    Assign ('Label_' & $i, 'GuiCtrlCreatePic('&Eval('Read' & $i)&','& $i + 1 * 43 &', 450, 35, 35)')
Next

Try that and tell me how it goes. :shocked:

Edit: Error in code :P

EDIT: No good if you edit one thing, and forget the other :(

Edited by bert
Link to comment
Share on other sites

That wouldn't work bert. You have the GUICtrlCreate...() in a string.

That line needs to be like:

Assign('Label_' & $i, GuiCtrlCreatePic(Eval('Read' & $i), ($i + 1) * 43, 450, 35, 35))oÝ÷ Ù:,¢g­)à)¶¬jëh×6_ArrayAdd($avButtons, GUICtrlCreateButton($b, Random(1, 200, 1), Random(1, 200, 1), 35, 35, $BS_BITMAP))oÝ÷ ØêÛzÛ^¯'­²)Üx.zË2¢íýw§¶Ú!j÷­é¢Ê^r'âr)íz»ÚÉbëbë,¢g­)à)¶¬jëh×6_ArrayAdd($avButtons, GUICtrlCreateButton($b, 35 * Random(1, 5, 1), 35 * Random(1, 5, 1), 35, 35, $BS_BITMAP))

But whatever, it's your code.

Also, I just realized that in the code I provided previously, I missed a closing bracket. That's why the syntax error. Sorry about that, I'll edit it now.

Edited by Saunders
Link to comment
Share on other sites

this should work if i didn't miss something lol

When you put something in brackets it means it's an array but if you add on the variable with the & sign it just adds it next to it. so $button_4 = $button_ & $a when a =4

CODE

Func Blank()

For $a = 1 to 20

GuiCtrlSetImage($Button_ & $a, @ScriptDir & "\Radio\blankitem.bmp)

Next

EndFunc

Link to comment
Share on other sites

this should work if i didn't miss something lol

When you put something in brackets it means it's an array but if you add on the variable with the & sign it just adds it next to it. so $button_4 = $button_ & $a when a =4

CODE

Func Blank()

For $a = 1 to 20

GuiCtrlSetImage($Button_ & $a, @ScriptDir & "\Radio\blankitem.bmp)

Next

EndFunc

You should test your code before posting.

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