anderson78 Posted May 6, 2012 Share Posted May 6, 2012 I am trying to create a countdown window to alert the user that a action is about to take place. I am doing this by creating a GUI box and then trying to change the background through three different jpeg images so that the user sees a box that this displays 3,2,1... in order. When I run my code the window is created but the background does not change to the jpeg images, it just remains blank. I am not trying to create any other controls in this window so I am not worried about the tabbing to other controls issue that I have seen in other posts. Thanks. GUICreate("Countdown",750,750) GUICtrlCreatePic("C:\Users\Anderson\Desktop\AutoIT testing\three.jpeg",0,0,600,600) GUISetState(@SW_SHOW) SLEEP(1000) GUICtrlCreatePic("C:\Users\Anderson\Desktop\AutoIT testing\two.jpeg",0,0,600,600) GUISetState(@SW_SHOW) SLEEP(1000) GUICtrlCreatePic("C:\Users\Anderson\Desktop\AutoIT testing\one.jpeg",0,0,600,600) GUISetState(@SW_SHOW) GUIDelete() Link to comment Share on other sites More sharing options...
johnmcloud Posted May 6, 2012 Share Posted May 6, 2012 (edited) A short example: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 233, 156) $Pic1 = GUICtrlCreatePic(@WorkingDir & "Test1.jpg", 8, 8, 209, 137) GUISetState(@SW_SHOW) Sleep(500) GUICtrlSetImage($Pic1, @WorkingDir & "Test2.jpg") Sleep(500) GUICtrlSetImage($Pic1, @WorkingDir & "Test3.jpg") Sleep(500) Exit While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited May 6, 2012 by johnmcloud Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 6, 2012 Moderators Share Posted May 6, 2012 Or, from the helpfile example for SplashTextOn: $message = "" SplashTextOn("TitleFoo", $message, -1, -1, -1, -1, 4, "") For $x = 10 To 1 Step -1 $message = $message & $x & @LF ControlSetText("TitleFoo", "", "Static1", $message) Sleep(100) Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
anderson78 Posted May 7, 2012 Author Share Posted May 7, 2012 (edited) Thanks for the input but I tried copying in your code and changing the file paths as a test and got the same result, the blank GUI which then closed after the timers were out. I would also like to note that I did have the constants included in my code as well, so I don't think it is related to that. Any other ideas?. I also just refreshed the window and saw the splash example. I will give that a try and see where it gets me. Thanks. Edited May 7, 2012 by anderson78 Link to comment Share on other sites More sharing options...
anderson78 Posted May 7, 2012 Author Share Posted May 7, 2012 Your splash text on worked, but I am trying to use jpeg images for my countdown and I've tried adapting your splash text code to images with no success. For whatever reason it seems like I can get pictures to be displayed... Link to comment Share on other sites More sharing options...
kylomas Posted May 7, 2012 Share Posted May 7, 2012 anderson78, If you do not need to have a picture display the countdown number try this script (the number is a control on a transparent background)#include <guiconstantsex.au3> #include <windowsconstants.au3> #include <WINAPI.au3> local $countdown = 3, $freq = 500 local $gui010 = GUICreate("",700,700 ,-1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) local $lbl010 = guictrlcreatelabel('',140,10,680,680) guictrlsetfont($lbl010,500,800) _WinAPI_SetLayeredWindowAttributes($gui010, 0xABCDEF, 250) guisetstate(@sw_show) for $i = $countdown to 1 step -1 guictrlsetdata($lbl010,$i) beep($freq,500) Sleep(1000) next ;shutdown(2) kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 7, 2012 Moderators Share Posted May 7, 2012 Your splash text on worked, but I am trying to use jpeg images for my countdown and I've tried adapting your splash text code to images with no success. For whatever reason it seems like I can get pictures to be displayed... If you need to use images, try something like this. Just plug in the path to your image: Local $destination = @DesktopDir & "test.jpg" For $x = 10 to 1 Step -1 If $x = "1" Then SplashImageOn("The program will begin in " & $x & " second.", $destination, 250, 50) Else SplashImageOn("The program will begin in " & $x & " seconds.", $destination, 250, 50) EndIf Sleep(1000) SplashOff() Sleep(500) Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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