locutus243 Posted November 17, 2005 Share Posted November 17, 2005 (edited) Hi Guys, I have a Gui below which works great. The only problem is that when I performed one action, i.e. opened the version details, then no other buttons will work. It bascially performs one function and then cease to be able to do anything else. Its probably something very simple that I'm missing out but I wondered if any of you AutoIT gurus could have a spy over my code and see if you can see where I'm going wrong. Thanks Mark P.S. Hope that the code isn't to muddled, I'm not great at formatting my work. expandcollapse popup; ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; ; Script Function: ; Demo of using functions ; ; This creates a GUI that includes a question and a button below ;============================== #include <GUIConstants.au3> #include <TarFileUpdate.au3> #include <TarSlimUpdate.au3> #include <CheckUpdates.au3> #include <Post-Imp Check.au3> ;============================== Global $tarfile = "J:\MERHCNTL\EK Rechner\Mark\Scripts in Progress\TarFileUpdate.au3" Global $answer ;============================== ; GUI GuiCreate("Sample GUI", 520, 520) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ;MENU $filemenu = GuiCtrlCreateMenu ("Updates") $fileitem = GuiCtrlCreateMenuitem ("Check Latest Updates",$filemenu) $recentfilesmenu = GuiCtrlCreateMenu ("Begin Update",$filemenu) $separator1 = GuiCtrlCreateMenuitem ("",$filemenu) $exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu) $helpmenu = GuiCtrlCreateMenu ("Help") $help = GuiCtrlCreateMenuitem ("Help",$helpmenu) $about = GuiCtrlCreateMenuitem ("About",$helpmenu) GuiSetState() ; TAB GuiCtrlCreateTab(0, 0, 800, 800) GuiCtrlCreateTabItem("Common Tasks") ; Create everything under the Common Tasks Tab $tar = GuiCtrlCreateCheckbox("Update Tar Files", 10, 50, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) $tarslim = GuiCtrlCreateCheckbox("Update Tar Slim Files", 10, 80, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) $pubreport = GuiCtrlCreateCheckbox("Create Publication Report", 10, 110, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) $errorlog = GuiCtrlCreateCheckbox("Update Error Log", 10, 140, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) GuiCtrlCreateTabItem("Pre-Imp Checks") ; Create everything underneath the Pre-Imp Checks Tab GuiCtrlCreateLabel("Checks that should be carried out before Implementation can be completed", 20, 40) $preimpcheck = GUICtrlCreateButton ("Perform Checks",275,140,100,30) $n1 = GuiCtrlCreateInput("Season", 265, 80, 130, 20) $seacheck = GUICtrlRead($n1) $n2 = GuiCtrlCreateInput("Pub Code", 265, 110, 130, 20) $pub = GUICtrlRead($n2) $Excelmaster = GUICtrlCreateButton ("Open Excel Pre-Imp Check Master File",20,80,50,40, $BS_ICON) GUICtrlSetImage (-1, "C:\Program Files\Microsoft Office\Office\EXCEL.EXE",0) GuiCtrlCreateLabel("Pre-Imp Master File", 5, 125) GuiCtrlCreateTabItem("Implementation") GuiCtrlCreatecombo("Sample Combo", 250, 80, 120, 100) ; Create everything underneath the Post-Imp Checks tab GuiCtrlCreateTabItem("Post-Imp Checks") $postimpcheck = GUICtrlCreateButton ("Perform Checks",195,80,100,30) $n3 = GuiCtrlCreateInput("Pubn Code", 180, 50, 130, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES) ;$pubn = GUICtrlRead($n3) $inerrorlog = GUICtrlCreateRadio("Error Log", 10, 50, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) $inUEBstatus = GUICtrlCreateRadio("UEB Status", 10, 80, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) $in1400status = GUICtrlCreateRadio("1400 Status", 10, 110, 150, 20) GuiCtrlSetState(-1, $GUI_UNCHECKED) ; Create everything underneath the Documentation tab GuiCtrlCreateTabItem("Documentation") $maintree = GUICtrlCreateTreeView (50,50,120,150) $aboutitem = GUICtrlCreateTreeViewItem ("Documentation",$maintree) $generalitem = GUICtrlCreateTreeViewItem ("AutoIT Help Files",$maintree) $toolsitem = GUICtrlCreateTreeViewItem ("Duties",$maintree) $effectitem = GUICtrlCreateTreeViewItem ("Helpful Tasks",$generalitem) $styleitem = GUICtrlCreateTreeViewItem ("Damito",$generalitem) $cmditem = GUICtrlCreateTreeViewItem ("Update Error Log",$toolsitem) $miscitem = GUICtrlCreateTreeViewItem ("Update Tar Files",$toolsitem) $descgroup = GUICtrlCreateGroup ("Description",200,120,180,55) GUICtrlSetState (-1,$GUI_HIDE) $effectstree = GUICtrlCreateTreeView (210,40,160,70,BitOr($BS_AUTOCHECKBOX,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE) GUICtrlSetState (-1,$GUI_HIDE) $effect1 = GUICtrlCreateTreeViewItem ("Damito Date Update",$effectstree) $effect2 = GUICtrlCreateTreeViewItem ("Update Return Code",$effectstree) $effect3 = GUICtrlCreateTreeViewItem ("Update Tar Files",$effectstree) $effect4 = GUICtrlCreateTreeViewItem ("Update TarSlim Files",$effectstree) $effect5 = GUICtrlCreateTreeViewItem ("Effect 5",$effectstree) $stylesgroup = GUICtrlCreateGroup ("Description",200,120,180,55) GUICtrlSetState (-1,$GUI_HIDE) $stylestree = GUICtrlCreateTreeView (210,40,160,70,BitOr($TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE) GUICtrlSetState (-1,$GUI_HIDE) $style1 = GUICtrlCreateTreeViewItem ("Style 1",$stylestree) $style2 = GUICtrlCreateTreeViewItem ("Style 2",$stylestree) $style3 = GUICtrlCreateTreeViewItem ("Style 3",$stylestree) $style4 = GUICtrlCreateTreeViewItem ("Style 4",$stylestree) $style5 = GUICtrlCreateTreeViewItem ("Style 5",$stylestree) $aboutlabel = GUICtrlCreateLabel ("Use the treeview on the left hand side to find the help file you require.",180,80,200,50) $cancelbutton = GUICtrlCreateButton ("Close",200,200,70,20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton ExitLoop Case $msg = $aboutitem GUIctrlSetState ($descgroup,$GUI_HIDE) GUIctrlSetState ($effectstree,$GUI_HIDE) GUIctrlSetState ($stylestree,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_SHOW) Case $msg = $effectitem GUIctrlSetState ($stylestree,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlSetState($effectstree,$GUI_SHOW) GUICtrlSetBkColor ($effectstree,0xD0F0F0) ;GUIctrlSetState...($effectstree,$GUI_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton ExitLoop Case $msg = $effect1 GUIctrlSetState ($stylestree,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlCreateLabel ("Damito Date Input.au3",200,120,180,55) $openbutton = GUICtrlCreateButton ("Open",280,200,70,20) GUISetState() While 1 $check = GuiGetMsg() If $check = $openbutton Then Run(@comspec & ' /c "J:\MERHCNTL\EK Rechner\Mark\Documentation\Damito Date Input.doc"','',@sw_hide) WEnd Case $msg = $effect2 GUIctrlSetState ($stylestree,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlSetState($effectstree,$GUI_SHOW) GUICtrlSetBkColor ($effectstree,0xD0F0F0) GUICtrlCreateLabel ("Return Code Update.au3",200,120,180,55) $openbutton = GUICtrlCreateButton ("Open",280,200,70,20) GUISetState() While 1 $check = GuiGetMsg() If $check = $openbutton Then MsgBox(0, "TEST", "Button is there!") WEnd Case $msg = $effect3 GUIctrlSetState ($stylestree,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlSetState($effectstree,$GUI_SHOW) GUICtrlSetBkColor ($effectstree,0xD0F0F0) GUICtrlCreateLabel ("TarFileUpdate.au3",200,120,180,55) $openbutton = GUICtrlCreateButton ("Open",280,200,70,20) GUISetState() While 1 $check = GuiGetMsg() If $check = $openbutton Then MsgBox(0, "TEST", "Button is there!") WEnd Case $msg = $effect4 GUIctrlSetState ($stylestree,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlSetState($effectstree,$GUI_SHOW) GUICtrlSetBkColor ($effectstree,0xD0F0F0) GUICtrlCreateLabel ("TarSlimUpdate.au3",200,120,180,55) $openbutton = GUICtrlCreateButton ("Open",280,200,70,20) GUISetState() While 1 $check = GuiGetMsg() If $check = $openbutton Then MsgBox(0, "TEST", "Button is there!") WEnd EndSelect WEnd Case $msg = $styleitem GUIctrlSetState ($effectstree,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($stylesgroup,$GUI_SHOW) GUIctrlSetState ($descgroup,$GUI_HIDE) ;GUIctrlSetState.($stylestree,$GUI_SHOW) GUICtrlSetState ($stylestree,$GUI_SHOW) GUICtrlSetColor ($stylestree,0xD00000) GUICtrlSetBkColor ($stylestree,0xD0FFD0) Case $msg = $tar TarFileAll() Case $msg = $tarslim AccessSlim() ;POST-IMP CHECK BUTTONS Case $msg = $postimpcheck PostImpCheck() Case $msg = $inerrorlog $answer = 1 Case $msg = $inUEBstatus $answer = 2 Case $msg = $in1400status $answer = 3 ;CONDITIONS IF THE USER USES THE TOOLBAR BUTTONS Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $fileitem CheckUpdates() Case $msg = $exititem Exit Case $msg = $about About() EndSelect WEnd GUIDelete() ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Edited May 1, 2008 by locutus243 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2005 Moderators Share Posted November 17, 2005 Hard to say with such a long code, and without the includes. When it goes to a function, does the function, does it exit the function... might you be stuck in a While Loop in the other function? How do you ever get to the second "while" and how do you ever get out of any of them?... I don't see ExitLoops for the mini "whiles". Your exiting if: $msg = -3 Or $msg = -1 Or $msg = $cancelbutton on both your main loops which is going to exit you out completely. Also, if you are going to redefine GUIGetMsg(), you might want to change the other While Loops to $msg2 = $msg3 = etc.. Just a couple of observations. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
CyberSlug Posted November 17, 2005 Share Posted November 17, 2005 You call GUIGetMsg() multiple times. You probably don't want to do that.... Look at using GUIGetMsg(1) which returns an array with more detailed info. Use Opt("TrayIconDebug", 1) to see what line numbers the code is "freezing" on Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
locutus243 Posted November 17, 2005 Author Share Posted November 17, 2005 Hey guys, Thanks for your input, much appreciated. I'll give your ideas a go and let you know how its working. Cheers Mark Link to comment Share on other sites More sharing options...
locutus243 Posted November 17, 2005 Author Share Posted November 17, 2005 I've tried altering the numerous GuiGetMsg() calls etc.. but found that its freezing after entering my CheckUpdates function from the #include file. I've included that file below, I don't think its stuck in a loop but I'm not entirely sure what effect While GuiGetMsg() <> $GUI_EVENT_CLOSE at the bottom has. I'm sorry for posting some much code in this thread, seems the best way to show my problem though :-) Thanks Mark Func CheckUpdates() GUICreate("Latest Updates", 250, 140, 200, 60) ; will create a dialog box ;Because these variables are only to be used to split the date in this script I have given them names that I can guarantee will not be used in any other script that maybe working in conjunction with this one! (Arsenal Players) GUICtrlCreateGroup("Latest Updates", 10, 10, 220, 125) $reyes = FileGetTime("C:\EK HIERARCHY\Compare\Tarfiles.mdb", 0) $tardate = $reyes[2] & "/" & $reyes[1] & "/" & $reyes[0] $lauren = FileGetTime("S:\MPC\EK DATA\Tarslim.ZIP", 0) $slimdate = $lauren[2] & "/" & $lauren[1] & "/" & $lauren[0] $fabregas = FileGetTime("C:\EK HIERARCHY\errorlog\error batch.mdb", 0) $errordate = $fabregas[2] & "/" & $fabregas[1] & "/" & $fabregas[0] $pires = FileGetTime("C:\EK HIERARCHY\Stats\flag checks\uk.mdb", 0) $sasflagdate = $pires[2] & "/" & $pires[1] & "/" & $pires[0] $henry = FileGetTime("C:\EK HIERARCHY\latest damito\latest damito.mdb", 0) $pubimpdate = $henry[2] & "/" & $henry[1] & "/" & $henry[0] ;$PreImpcheckingpublistupdate = GUICtrlCreateLabel("TarFiles: " & $tardate, 20, 30) GUICtrlCreateLabel("TarSlim: " & $slimdate, 20, 50) GUICtrlCreateLabel("Error Log: " & $errordate, 20, 70) GUICtrlCreateLabel("SasFlag: " & $sasflagdate, 20, 90) GUICtrlCreateLabel("Pub Imp Report: " & $pubimpdate, 20, 110) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2005 Moderators Share Posted November 17, 2005 (edited) $MAIN_GUI = ("Sample GUI", 520, 520) ; making the main gui a variable ;Further down where you call to updates Case $msg = $fileitem GUISetState(@SW_DISABLE, $MAIN_GUI) CheckUpdates() GUISetState(@SW_ENABLE, $MAIN_GUI) ;Then in the Check Updates $UPDATE_GUI = GUICreate("Latest Updates", 250, 140, 200, 60) ; will create a dialog box While 1 $UPDATE_MSG = GUIGetMsg() If $UPDATE_MSG = $GUI_EVENT_CLOSE Then GUIDelete($UPDATE_GUI) ExitLoop Sleep(100); Don't burn out the cpu WEnd EDIT: Forgot to get rid of the 2nd GUI so you can return to the main one Edited November 17, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
locutus243 Posted November 18, 2005 Author Share Posted November 18, 2005 Hey Ron, I'm not sure exactly how ur solution works but it certainly seems to do the trick. Thanks for all your time and effort in helping me, hopefully one day I can do the same for you. (After much more practice with my GUIs!!!!) Cheers Mark 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