TheOnlyOne Posted June 20, 2009 Share Posted June 20, 2009 okay the problem is i have 1 gui and then a new one need to pop up but when this happen and i need to close the gui there just opened agian that works but when i try to do the same thing one time more i get a error "C:\Programmer\AutoIt3\Include\ProgressConstants.au3 (10) : ==> Can not redeclare a constant.: Global Const $PBS_MARQUEE = 0x00000008 Global Const ^ ERROR" this is my code expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $hp=50 $money=20 $timetorepair=20 $05=5 $03=3 $1l=2 $1_5=3 $2l=2 $z=8 #Region ### START Koda GUI section ### Form=C:\Documents and Settings\lo\Skrivebord\auto it games\thomas game\start menu.kxf $Form1 = GUICreate("Form1", 633, 447, 200, 133) GUISetBkColor(0x800000) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\lo\Skrivebord\auto it games\fight game\man-stand1.jpg", 24, 168, 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic2 = GUICtrlCreatePic("C:\Documents and Settings\lo\Skrivebord\auto it games\thomas game\coca cola mashine.jpg", 192, 120, 76, 148, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Label1 = GUICtrlCreateLabel("HP :"&$hp, 192, 56, 220, 20) $Label2 = GUICtrlCreateLabel("Money :"&$money, 192, 96, 220, 20) $Button1 = GUICtrlCreateButton("Drink cola", 280, 120, 99, 25, 0) $Button2 = GUICtrlCreateButton("Make money", 280, 184, 99, 25, 0) $Label3 = GUICtrlCreateLabel("mood: HAPPY", 24, 112, 121, 20) GUICtrlSetColor(-1, 0x00FF00) $Button3 = GUICtrlCreateButton("Sleep (+1hp)", 280, 224, 99, 25, 0) $Button4 = GUICtrlCreateButton("buy cola ", 280, 152, 99, 25, 0) $Label4 = GUICtrlCreateLabel("And the program for you ... :P", 408, 48, 203, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("Input1", 416, 120, 121, 21) $Label5 = GUICtrlCreateLabel("Time before shutdown", 416, 96, 129, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button5 = GUICtrlCreateButton("start", 432, 152, 75, 25, 0) $Label6 = GUICtrlCreateLabel("Counter:", 424, 200, 44, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg case $Button2 #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $sec=0 $sec2=0 #Region ### START Koda GUI section ### Form= $Form4 = GUICreate("Form1", 405, 90, 193, 125) $Progress1 = GUICtrlCreateProgress(16, 56, 174, 17) $Progress2 = GUICtrlCreateProgress(200, 56, 150, 17) $Labe1 = GUICtrlCreateLabel("Status on moveing a stone"&@crlf&" to the place it should be", 16, 20, 246, 25) $Labe2 = GUICtrlCreateLabel("status on working", 200, 32, 87, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $showed=1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE EndSwitch sleep (10) $sec=$sec+2 guictrlsetdata($Progress1,$sec) guictrlsetdata($Progress2,$sec2) if $sec=100 then $sec2=$sec2+10 $sec=0 endif if $sec2=100 then $2sec=0 $money=$money+15 $hp=$hp-10 sleep (50) ExitLoop(0) GUIDelete($form4) continueloop (2) endif WEnd Link to comment Share on other sites More sharing options...
GodlessSinner Posted June 20, 2009 Share Posted June 20, 2009 Im not, understand, why you creates GUI inside a While??? And look at this:Case $GUI_EVENT_CLOSE EndSwitchYou miss type ExitCase $GUI_EVENT_CLOSE Exit EndSwitch _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
GodlessSinner Posted June 20, 2009 Share Posted June 20, 2009 It's must be rewritten, almost all. If you really need it, i can do this. _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
GodlessSinner Posted June 20, 2009 Share Posted June 20, 2009 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $hp=50 $money=20 $timetorepair=20 $05=5 $03=3 $1l=2 $1_5=3 $2l=2 $z=8 $sec=0 $sec2=0 #Region ### START Koda GUI section ### Form=C:\Documents and Settings\lo\Skrivebord\auto it games\thomas game\start menu.kxf $Form1 = GUICreate("Form1", 633, 447, 200, 133) GUISetBkColor(0x800000) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\lo\Skrivebord\auto it games\fight game\man-stand1.jpg", 24, 168, 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic2 = GUICtrlCreatePic("C:\Documents and Settings\lo\Skrivebord\auto it games\thomas game\coca cola mashine.jpg", 192, 120, 76, 148, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Label1 = GUICtrlCreateLabel("HP :"&$hp, 192, 56, 220, 20) $Label2 = GUICtrlCreateLabel("Money :"&$money, 192, 96, 220, 20) $Button1 = GUICtrlCreateButton("Drink cola", 280, 120, 99, 25, 0) $Button2 = GUICtrlCreateButton("Make money", 280, 184, 99, 25, 0) $Label3 = GUICtrlCreateLabel("mood: HAPPY", 24, 112, 121, 20) GUICtrlSetColor(-1, 0x00FF00) $Button3 = GUICtrlCreateButton("Sleep (+1hp)", 280, 224, 99, 25, 0) $Button4 = GUICtrlCreateButton("buy cola ", 280, 152, 99, 25, 0) $Label4 = GUICtrlCreateLabel("And the program for you ... :P", 408, 48, 203, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("Input1", 416, 120, 121, 21) $Label5 = GUICtrlCreateLabel("Time before shutdown", 416, 96, 129, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button5 = GUICtrlCreateButton("start", 432, 152, 75, 25, 0) $Label6 = GUICtrlCreateLabel("Counter:", 424, 200, 44, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 AnotherGui() EndSwitch WEnd Func AnotherGui() $Form4 = GUICreate("Form1", 405, 90, 193, 125) $Progress1 = GUICtrlCreateProgress(16, 56, 174, 17) $Progress2 = GUICtrlCreateProgress(200, 56, 150, 17) $Labe1 = GUICtrlCreateLabel("Status on moveing a stone"&@crlf&" to the place it should be", 16, 20, 246, 25) $Labe2 = GUICtrlCreateLabel("status on working", 200, 32, 87, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $Msg = GUIGetMsg() sleep (10) $sec=$sec+2 guictrlsetdata($Progress1,$sec) guictrlsetdata($Progress2,$sec2) if $sec=100 then $sec2=$sec2+10 $sec=0 endif if $sec2=100 then $2sec=0 $money=$money+15 $hp=$hp-10 sleep (50) EndIf Until $Msg = $GUI_EVENT_CLOSE GUIDelete() EndFunc _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
TheOnlyOne Posted June 20, 2009 Author Share Posted June 20, 2009 thanks that helped alot mistake by me at removeing that with Case $GUI_EVENT_CLOSE Exit 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