Monty Posted May 31, 2011 Share Posted May 31, 2011 Is there a way to restart this script...ie: close script and run it again by pressing restart button. #include <GUIConstants.au3> $gui_main = GUICreate("GUIName", 400, 250) $button = GUICtrlCreateButton("Restart", 15, 15, 75, 30) GUISetState() Do $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $button ??? EndSelect Until Not WinExists($gui_main) Link to comment Share on other sites More sharing options...
JoHanatCent Posted May 31, 2011 Share Posted May 31, 2011 Is there a way to restart this script...ie: close script and run it again by pressing restart button. #include <GUIConstants.au3> $gui_main = GUICreate("GUIName", 400, 250) $button = GUICtrlCreateButton("Restart", 15, 15, 75, 30) GUISetState() Do $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $button ??? EndSelect Until Not WinExists($gui_main) Although this can be accomplish it might not be a good idea. What do you want to achieve that can not be done with Gui hide / Gui display etc? Link to comment Share on other sites More sharing options...
Monty Posted May 31, 2011 Author Share Posted May 31, 2011 Although this can be accomplish it might not be a good idea.What do you want to achieve that can not be done with Gui hide / Gui display etc?i tried gui hide/display but did not work.on the actual script i am changing gui with tabs to different colour.it is simple when there are no tabs, but so far found no answers with tab.i used..._GUICtrlTab_SetBkColor($gui_main, $tab, IniRead(@MyDocumentsDir & "\file.ini", "Colour", "Body", ""))...but fields and things go invisible on tabs when command is used again.i was just thinking of restarting script unless there could be another way. Link to comment Share on other sites More sharing options...
JoHanatCent Posted May 31, 2011 Share Posted May 31, 2011 i tried gui hide/display but did not work.on the actual script i am changing gui with tabs to different colour.it is simple when there are no tabs, but so far found no answers with tab.i used..._GUICtrlTab_SetBkColor($gui_main, $tab, IniRead(@MyDocumentsDir & "\file.ini", "Colour", "Body", ""))...but fields and things go invisible on tabs when command is used again.i was just thinking of restarting script unless there could be another way.MayBe can help? Link to comment Share on other sites More sharing options...
Monty Posted May 31, 2011 Author Share Posted May 31, 2011 thanks. i have no problems having different colours on different tabs. infact my script is very similar to example you have given. the issue i'm facing is changing the colour on the tab while the script is running. take the example you have given. it has a button called "some button". lets say if you press this button and it will change the colour of the tab from red to yellow...hopefully without even restarting the script. onces again, thank you for your time. really appreciate u trying to help. Link to comment Share on other sites More sharing options...
Monty Posted May 31, 2011 Author Share Posted May 31, 2011 and i like your lion too Link to comment Share on other sites More sharing options...
JoHanatCent Posted May 31, 2011 Share Posted May 31, 2011 (edited) and i like your lion too Thank You My understanding is that the trick is just to change the "Label" Try this and see if it works better for you: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $tab, $tab0, $tab0OK, $tab0input Local $tab1, $tab1combo, $tab1OK Local $tab2, $tab2OK, $msg GUICreate("A Title", 250, 150) GUISetBkColor(0x00E0FFFF) $tab = GUICtrlCreateTab(10, 10, 200, 100) $tab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) $tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20) $tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20) $tab1 = GUICtrlCreateTabItem("tab1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120) $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) $Label2 = GUICtrlCreateLabel("", 12, 32, 194, 75) GUICtrlSetBkColor($Label2, Random(0x000000, 0xFFFFFF)) $tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50, 50) GUICtrlSetState(-1, $GUI_ontop) GUICtrlCreateTabItem("") GUICtrlCreateLabel("", 147, 10, 200, 20) GUICtrlSetBkColor(-1, 0x00E0FFFF) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $tab Then WinSetTitle("GUI Tab", "", "GUI Tab" & GUICtrlRead($tab)) EndIf If $msg = $tab2OK Then GUICtrlSetBkColor($Label2, Random(0x000000, 0xFFFFFF)) EndIf WEnd EndFunc ;==>Example Press the OK2 button to change colour! Added foot(paw) note! Edited May 31, 2011 by JoHanatCent 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