NutherNoob Posted January 20, 2007 Posted January 20, 2007 Hi everyone. I'm at a deadend with this script atm (trying to get each numbered Eg. to countdown, then start the next Eg.) and I feel its gotten abit out of hand. Can all the $vars ($hrs,$mins,$secs,$ttl etc) be tidied up somehow as I want to have say 10 of these Eg.'s. This may make it abit easier for me on the next step: countdown loop. Not finding much on what I want to do on the forums but maybe cleaning it up abit will help somehow. Thanx in advance. expandcollapse popup#include <GUIConstants.au3> ;master gui vars $master_gui_width = 320 $master_gui_hight = 250 $gui_master_x_start = 700 $gui_master_y_start = 120 ; variables group $default_group_width = 230 $x_var_group = 5 $y_var_group = 10 $var_group_width = $default_group_width $var_group_hight = $master_gui_hight - 100 ;positions vars group $pdefault_group_width = ($master_gui_width - $default_group_width) $px_var_group = 237 $py_var_group = 10 $pvar_group_width = $pdefault_group_width -10 $pvar_group_hight = $master_gui_hight - 100 ; = END DEFINE VARIABLES ; ===== START MASTER GUI GUICreate("=- Test -=", $master_gui_width, $master_gui_hight , $gui_master_x_start, $gui_master_y_start, -1) GUISetState () WinSetOnTop("=- Test -=", "", 1) ; MENU GuiCtrlCreateMenu("Menu &One") GuiCtrlCreateMenu("Menu &Two") GUICtrlCreateGroup ("Times", $x_var_group , $y_var_group , $var_group_width , $var_group_hight) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateGroup ("Positions", $px_var_group , $py_var_group , $pvar_group_width , $pvar_group_hight) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group ;Hrs, secs title $widthCell=100 GUICtrlCreateLabel ("Hrs. Mins. Secs.", 50 , 40, $widthCell) ;1st eg and pos. $widthCellb=40 $diff=27 GUICtrlCreateLabel ("Eg 1.", $x_var_group +2, $y_var_group +$diff*2, $widthCellb) ; $hrs1=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*2)-3, 18, 17,$ES_NUMBER) ; hrs $mins1=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;mins $secs1=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;secs $Conv1=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*2)-3, 45, 17) ;convert button $ttl1=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*2)-3, 40, 17, $ES_NUMBER) ;secsttl $xy1=GUICtrlCreateButton("Click", 255, ($y_var_group +$diff*2)-3, 40, 17) ;2nd eg and pos. GUICtrlCreateLabel ("Eg 2.", $x_var_group +2, $y_var_group +$diff*3, $widthCellb) ; $hrs2=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ; hrs $mins2=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;mins $secs2=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;secs $Conv2=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*3)-3, 45, 17) ;convert button $ttl2=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*3)-3, 40, 17, $ES_NUMBER) ;secsttl $xy2=GUICtrlCreateButton("Click", 255, ($y_var_group +$diff*3)-3, 40, 17) ;3rd eg and pos. GUICtrlCreateLabel ("Eg 3.", $x_var_group +2, $y_var_group +$diff*4, $widthCellb) ; $hrs3=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ; hrs $mins3=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;mins $secs3=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;secs $Conv3=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*4)-3, 45, 17) ;convert button $ttl3=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*4)-3, 40, 17, $ES_NUMBER) ;secsttl $xy3=GUICtrlCreateButton("Click", 255, ($y_var_group +$diff*4)-3, 40, 17) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Conv1 $convsec1=(GuiCtrlRead($hrs1)*3600)+(GuiCtrlRead($mins1)*60)+GuiCtrlRead($secs1) GUICtrlSetData ($ttl1, $convsec1) Case $msg = $Conv2 $convsec2=(GuiCtrlRead($hrs2)*3600)+(GuiCtrlRead($mins2)*60)+GuiCtrlRead($secs2) GUICtrlSetData ($ttl2, $convsec2) Case $Msg = $Conv3 $convsec3=(GuiCtrlRead($hrs3)*3600)+(GuiCtrlRead($mins3)*60)+GuiCtrlRead($secs3) GUICtrlSetData ($ttl3, $convsec3) EndSelect WEnd
Paulie Posted January 20, 2007 Posted January 20, 2007 For...Next Loop and some arrays my friend I got all the GUIs to display, but they are kind of overlapping, i could fix this code more, but i haven't slept in 38 hours as of now, so i think i'm going to take a nap. You'll have to fix the gui and make a case statment for each eg. Sorry i can't help you more, but maybe this'll at least point you in the right direction expandcollapse popup#include <GUIConstants.au3> ;master gui vars $master_gui_width = 320 $master_gui_hight = 250 $gui_master_x_start = 700 $gui_master_y_start = 120 ; variables group $default_group_width = 230 $x_var_group = 5 $y_var_group = 10 $var_group_width = $default_group_width $var_group_hight = $master_gui_hight - 100 ;positions vars group $pdefault_group_width = ($master_gui_width - $default_group_width) $px_var_group = 237 $py_var_group = 10 $pvar_group_width = $pdefault_group_width -10 $pvar_group_hight = $master_gui_hight - 100 ; = END DEFINE VARIABLES ; ===== START MASTER GUI GUICreate("=- Test -=", $master_gui_width, $master_gui_hight , $gui_master_x_start, $gui_master_y_start, -1) GUISetState (@SW_SHOW) ; MENU GuiCtrlCreateMenu("Menu &One") GuiCtrlCreateMenu("Menu &Two") GUICtrlCreateGroup ("Times", $x_var_group , $y_var_group , $var_group_width , $var_group_hight) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateGroup ("Positions", $px_var_group , $py_var_group , $pvar_group_width , $pvar_group_hight) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group ;Hrs, secs title $widthCell=100 GUICtrlCreateLabel ("Hrs. Mins. Secs.", 50 , 40, $widthCell) ;SKILLS ;1st eg and pos. Global $hrs[11], $mins[11], $secs[11], $Conv[11], $ttl[11],$convsec[11] For $a = 1 to 10 $widthCellb=40 $diff=27 GUICtrlCreateLabel ("Eg "&$a&".", $x_var_group +2, $y_var_group +$diff*$a+1, $widthCellb) ; $hrs[$a]=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*$a+1)-3, 18, 17,$ES_NUMBER) ; hrs $mins[$a]=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*$a+1)-3, 18, 17, $ES_NUMBER) ;mins $secs[$a]=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*$a+1)-3, 18, 17, $ES_NUMBER) ;secs $Conv[$a]=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*$a+1)-3, 45, 17) ;convert button $ttl[$a]=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*$a+1)-3, 40, 17, $ES_NUMBER) ;secsttl Next GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Conv[1] $convsec[1]=(GuiCtrlRead($hrs[1])*3600)+(GuiCtrlRead($mins[1])*60)+GuiCtrlRead($secs[1]) GUICtrlSetData ($ttl[1], $convsec[1]) Case $msg = $Conv[2] $convsec[2]=(GuiCtrlRead($hrs[2])*3600)+(GuiCtrlRead($mins[2])*60)+GuiCtrlRead($secs[2]) GUICtrlSetData ($ttl[2], $convsec[2]) Case $Msg = $Conv[3] $convsec[3]=(GuiCtrlRead($hrs[3])*3600)+(GuiCtrlRead($mins[3])*60)+GuiCtrlRead($secs[3]) GUICtrlSetData ($ttl[3], $convsec[3]) EndSelect WEnd
_Kurt Posted January 20, 2007 Posted January 20, 2007 but i haven't slept in 38 hours as of now, so i think i'm going to take a nap.Ouch, my record is only 29 hours!G'nightKurt Awaiting Diablo III..
Helge Posted January 20, 2007 Posted January 20, 2007 See...now people post in two topics instead of having all answers in one topic, which causes confusion and posts like this one. Also, what's so much better in having two topics anyway ? If they find the first one they can find the second one as well. If they ignore the first they can ignore the second one as well. Just be glad you receive replies and don't think it's accepted to just create another topic when you haven't gotten any useful replies for the last hours. Just bump, wait for a reply and if nobody answers then try more on your own, like everyone else do, or do you think you're so special that you deserve to get the extra attention, like some other 6 year old kid ?
NutherNoob Posted January 20, 2007 Author Posted January 20, 2007 Paulie, again you were a great help. Thanx! Helge, I posted in the other forum and waited - nothing. I did try and BUMP to the top, but as you'll see...... nothing. Not 1 helpful reply. Noticed that everyone was watching this forum so decided to try my luck here. I did try solving this myself (I may not be as good at this as you) thats why I reached a deadend and got a little frustrated and posted here too. I'm very new to all this scripting but I'm learning. I dont think there's any need to have a go at me.
LxP Posted January 21, 2007 Posted January 21, 2007 Newcomers don't always know these things so I think it's okay to be a little lenient at first about these things. Anyway, since this thread is more about code cleanup than GUI stuff, I propose we lock the other thread and carry on here.
theguy0000 Posted January 21, 2007 Posted January 21, 2007 (edited) Newcomers don't always know these things so I think it's okay to be a little lenient at first about these things. Anyway, since this thread is more about code cleanup than GUI stuff, I propose we lock the other thread and carry on here.http://www.autoitscript.com/fileman/users/gafrosts_wife/Emoticons/offtopic.gif LxP! I havent seen you around here in awhile! Welcome back [/offtopic] Edited January 21, 2007 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
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