wiipenmaker Posted February 21, 2009 Share Posted February 21, 2009 (edited) I have 3 seperate image files. I would like to be able to the following in one GUI one of the pics named 1 2 or 3 .jpg is displayed a random number of times When a button is pressed a different image 1 2 or 3 .jpg is displayed a random number of times This is how I have the original pictures being displayed $x = Random(1,9,1) $p = Random(1,3,1) For $i = 1 to $x GUICtrlCreatePic($p&".jpg",100*($i-1),0,100,100) Next Thanks Edited February 21, 2009 by wiipenmaker Link to comment Share on other sites More sharing options...
Zedna Posted February 21, 2009 Share Posted February 21, 2009 (edited) $pic = GUICtrlCreatePic("",0,0,100,100) $x = Random(1,9,1) $p = Random(1,3,1) For $i = 1 to $x GUICtrlSetImage($pic, $p&".jpg") Next Edited February 21, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
wiipenmaker Posted February 21, 2009 Author Share Posted February 21, 2009 My problem is that if I name the GUICtrlCreatePic, $pic then the set image would only work for one not all random x of themI have 3 seperate image files.I would like to be able to the following in one GUIone of the pics named 1 2 or 3 .jpg is displayed a random number of timesWhen a button is pressed a different image 1 2 or 3 .jpg is displayed a random number of timesThis is how I have the original pictures being displayed$x = Random(1,9,1) $p = Random(1,3,1) For $i = 1 to $xGUICtrlCreatePic($p&".jpg",100*($i-1),0,100,100) NextThanks Link to comment Share on other sites More sharing options...
Zedna Posted February 21, 2009 Share Posted February 21, 2009 (edited) Maybe something like this? $pic1 = GUICtrlCreatePic("",0,0,100,100) $pic2 = GUICtrlCreatePic("",100,0,100,100) $pic3 = GUICtrlCreatePic("",200,0,100,100) For $i = 1 to 3 $p = Random(1,3,1) GUICtrlSetImage(Eval("pic" & $i), $p & ".jpg") Next EDIT: corrected syntax errors in Eval Edited February 21, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
wiipenmaker Posted February 21, 2009 Author Share Posted February 21, 2009 It worked thanks Link to comment Share on other sites More sharing options...
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