AutoitFaN1000 Posted August 4, 2009 Share Posted August 4, 2009 How can i do MsgBox(1, "Timer start", "You pressed the start button. The timer will run for "..GUICtrlRead($Time).." "..$Words.."." ) where i make it say $Time and $Words? Thanks. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 4, 2009 Developers Share Posted August 4, 2009 Concatenation character is & Just search for it in the helpfile with the correct spelling >_< Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AutoitFaN1000 Posted August 4, 2009 Author Share Posted August 4, 2009 (edited) Thanks, i got that, but can someone help me here, i don't get what variable is not being declared? expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 443, 192, 124) $Label1 = GUICtrlCreateLabel("Welcome to this timing program. Procede with caution ", 64, 32, 460, 28) GUICtrlSetFont(-1, 14, 400, 2, "MS Sans Serif") $Time = GUICtrlCreateInput("Time", 232, 96, 209, 21) $Radio1 = GUICtrlCreateRadio("Seconds", 144, 160, 113, 17) $Radio2 = GUICtrlCreateRadio("Munites", 144, 184, 113, 17) $Radio3 = GUICtrlCreateRadio("Hours", 144, 208, 113, 17) $Radio4 = GUICtrlCreateRadio("Miliseconds (1000 of these = 1 second)", 144, 136, 209, 17) $Button1 = GUICtrlCreateButton("Enable", 152, 280, 377, 145) GUICtrlSetFont(-1, 72, 800, 4, "Segoe Script") GUICtrlSetBkColor(-1, 0x008000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $Words = "" While 1 $nMsg = GUIGetMsg() If $nMsg = $Button1 Then If $nMsg = $Radio4 Then $Timee = GUICtrlRead($Time) $Words = "miliseconds" EndIf If $nMsg = $Radio1 Then $Timee = GUICtrlRead($Time)*1000 $Words = "seconds" EndIf If $nMsg = $Radio2 Then $Timee = (GUICtrlRead($Time)*1000)*60 $Words = "minutes" EndIf If $nMsg = $Radio3 Then $Timee = ((GUICtrlRead($Time)*1000)*60)*60 $Words = "hours" EndIf MsgBox(1, "Timer start", "You pressed the start button. The timer will run for "&GUICtrlRead($Time)&" "&$Words&", in miliseconds, thats "&$Timee&"." ) EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks >_< By the way, without the ", in miliseconds, thats "&$Timee&"." it works just fine. Actually, it'll only run like this. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 443, 192, 124) $Label1 = GUICtrlCreateLabel("Welcome to this timing program. Procede with caution ", 64, 32, 460, 28) GUICtrlSetFont(-1, 14, 400, 2, "MS Sans Serif") $Time = GUICtrlCreateInput("Time", 232, 96, 209, 21) $Radio1 = GUICtrlCreateRadio("Seconds", 144, 160, 113, 17) $Radio2 = GUICtrlCreateRadio("Munites", 144, 184, 113, 17) $Radio3 = GUICtrlCreateRadio("Hours", 144, 208, 113, 17) $Radio4 = GUICtrlCreateRadio("Miliseconds (1000 of these = 1 second)", 144, 136, 209, 17) $Button1 = GUICtrlCreateButton("Enable", 152, 280, 377, 145) GUICtrlSetFont(-1, 72, 800, 4, "Segoe Script") GUICtrlSetBkColor(-1, 0x008000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $Words = "" While 1 $nMsg = GUIGetMsg() If $nMsg = $Radio4 Then $Timee = GUICtrlRead($Time) $Words = "miliseconds" EndIf If $nMsg = $Radio1 Then $Timee = GUICtrlRead($Time)*1000 $Words = "seconds" EndIf If $nMsg = $Radio2 Then $Timee = (GUICtrlRead($Time)*1000)*60 $Words = "minutes" EndIf If $nMsg = $Radio3 Then $Timee = ((GUICtrlRead($Time)*1000)*60)*60 $Words = "hours" EndIf If $nMsg = $Button1 Then MsgBox(1, "Timer start", "You pressed the start button. The timer will run for "&GUICtrlRead($Time)&" "&$Words&"." ) EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited August 4, 2009 by AutoitFaN1000 Link to comment Share on other sites More sharing options...
Developers Jos Posted August 4, 2009 Developers Share Posted August 4, 2009 declare $Timee Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Szhlopp Posted August 4, 2009 Share Posted August 4, 2009 Stuff isn't declared global. So when it exits the local scope, the variable goes 'poof'. Here you go. Rewrite... expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ; Global $Words, $Timee #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 443, 192, 124) $Label1 = GUICtrlCreateLabel("Welcome to this timing program. Procede with caution ", 64, 32, 460, 28) GUICtrlSetFont(-1, 14, 400, 2, "MS Sans Serif") $Time = GUICtrlCreateInput("1000", 232, 96, 209, 21, 0x2000) ; 0x2000 = ES_NUMBER $Radio1 = GUICtrlCreateRadio("Seconds", 144, 160, 113, 17) $Radio2 = GUICtrlCreateRadio("Minutes", 144, 184, 113, 17) $Radio3 = GUICtrlCreateRadio("Hours", 144, 208, 113, 17) $Radio4 = GUICtrlCreateRadio("Miliseconds (1000 of these = 1 second)", 144, 136, 209, 17) $Button1 = GUICtrlCreateButton("Enable", 152, 280, 377, 145) GUICtrlSetFont(-1, 72, 800, 4, "Segoe Script") GUICtrlSetBkColor(-1, 0x008000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $Words = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Radio4) = $GUI_CHECKED Then $Timee = GUICtrlRead($Time) $Words = "miliseconds" MsgBox(1, "Timer start", "You pressed the start button. The timer will run for " & GUICtrlRead($Time) & " " & $Words & ", in miliseconds, thats " & $Timee & "." ) ElseIf GUICtrlRead($Radio1) = $GUI_CHECKED Then $Timee = GUICtrlRead($Time)*1000 $Words = "seconds" MsgBox(1, "Timer start", "You pressed the start button. The timer will run for " & GUICtrlRead($Time) & " " & $Words & ", in miliseconds, thats " & $Timee & "." ) ElseIf GUICtrlRead($Radio2) = $GUI_CHECKED Then $Timee = (GUICtrlRead($Time)*1000)*60 $Words = "minutes" MsgBox(1, "Timer start", "You pressed the start button. The timer will run for " & GUICtrlRead($Time) & " " & $Words & ", in miliseconds, thats " & $Timee & "." ) ElseIf GUICtrlRead($Radio3) = $GUI_CHECKED Then $Timee = (GUICtrlRead($Time)*1000)*3600 $Words = "hours" MsgBox(1, "Timer start", "You pressed the start button. The timer will run for " & GUICtrlRead($Time) & " " & $Words & ", in miliseconds, thats " & $Timee & "." ) EndIf EndSwitch WEnd RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
AutoitFaN1000 Posted August 4, 2009 Author Share Posted August 4, 2009 (edited) Thanks, but how could i intergrate this Sleep( $Timee ) MsgBox(0, "Times up!", "Your time is up!!") into the code you so kindly rewrote for me. It seems that you are runing the messagebox when they hit Radio3, so i dont know where to put the sleep part... Edited August 4, 2009 by AutoitFaN1000 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