kayser2008 Posted October 15, 2015 Share Posted October 15, 2015 Hi allI´m doing a Gui that has one image on the background and need to show several images on top of that main image in diferent places (w/h) when i press a keyboard buttoni have done that with the Random() function, but that way i can´t control the last image that will show can someone point me what´s the best way to do that show 30 images and stop on image 24show 30 images and stop on image 12show 30 images and stop on image 1Thanks Link to comment Share on other sites More sharing options...
AutoBert Posted October 16, 2015 Share Posted October 16, 2015 And where is the script? Link to comment Share on other sites More sharing options...
kayser2008 Posted October 17, 2015 Author Share Posted October 17, 2015 (edited) HotKeySet("{5}", "Play") Local $gui,$COLOR_BLACK = 0xFFFF00 ,$wdt = 800, $hdt = 600 $gui = GUICreate("", $hdt, $wdt, -1, -1, $WS_POPUP) GUICtrlCreatePic("Pics\main.jpg",-1,-1,$hdt,$wdt) GUISetState(@SW_SHOW) Func Play() $Images = Random(1,10,1) Sleep(200) SplashImageOn("","Pics\" & $Images & ".jpg",580,85,667,819,$DLG_NOTITLE) EndFunc Do If _IsPressed("36") Then While _IsPressed("36") WEnd Play() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSEI´m doing like that but that way just shows randon images in the end , is there a way to control wath image shows in the end or to control wath images to show? Edited October 17, 2015 by kayser2008 Link to comment Share on other sites More sharing options...
AutoBert Posted October 17, 2015 Share Posted October 17, 2015 (edited) This should work like you want:expandcollapse popup#include <array.au3> #include <AutoItConstants.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> HotKeySet("{5}", "RandomPlay") Local $gui, $wdt = 800, $hdt = 600 $gui = GUICreate("", $hdt, $wdt, -1, -1, $WS_POPUP) GUICtrlCreatePic("Pics\main.jpg", -1, -1, $hdt, $wdt) GUISetState(@SW_SHOW) Global $aImages[30] ;populate array with ImageNo. For $i = 0 To 29 $aImages[$i] = $i + 1 Next Global $aWantedLast[] = [24, 12, 1] Do For $i = 0 To UBound($aWantedLast) - 1 _ArrayShuffle($aImages) ;_ArrayDisplay($aImages) ;this is the shuffled array ConsoleWrite('Swaped Images: ' & $aImages[UBound($aImages) - 1] & '<==>' & @TAB) $iWantedLast = _ArraySearch($aImages, $aWantedLast[$i]) _ArraySwap($aImages, $iWantedLast, $aImages[UBound($aImages) - 1]) ;_ArrayDisplay($aImages) ;this is the shuffled array with changed last ImageNo. ConsoleWrite($aImages[UBound($aImages) - 1] & @CRLF) For $j = 0 To UBound($aImages) - 1 If _IsPressed("36") Then While _IsPressed("36") WEnd Play($aImages[$j]) EndIf Next Next Until GUIGetMsg() = $GUI_EVENT_CLOSE Func RandomPlay() Play(Random(0, UBound($aImages) - 1, 1)) EndFunc ;==>RandomPlay Func Play($Images) Sleep(200) SplashImageOn("", "Pics\" & $Images & ".jpg", 580, 85, 667, 819, $DLG_NOTITLE) EndFunc ;==>PlayPlease have a look in the help for UBound and the _Array_* functions i used. When you never worked with arrays alsoLanguage ReferenceThe basics of the AutoIt language:DatatypesVariables --> Arrays... Edited October 17, 2015 by AutoBert 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