Craberos 0 Posted May 18, 2010 (edited) hello all thanks for the help recently i finally did my button script could anyone help me convert this script in to a checkbox version right now there are 4 buttons when i click on them an active window which is minimized with that name pops up ..... but i have to click them individually could anyone help me convert them to check box so if i select 3 and press a button they will pop up and stay cascaded and also a button to minimize all active windows and at the start of the programe open 4 files named "earth.txt,fire.txt,water.txt & air.txt" from the source directory so a total of 4 check boxes 2 buttons [1 for minimize all windows , 1 for after the selection of check boxes to say ok ] #include <GUIConstantsEx.au3> ShellExecute("Earth.txt",0) ShellExecute("Water.txt",0) ShellExecute("Air.txt",0) ShellExecute("Fire.txt",0) Opt('MustDeclareVars', 1) Example() Func Example() Local $button_1,$button_2, $button_3, $button_4 Local $Halt, $msg Opt("GUICoordMode", 1) GUICreate("T", 140, 260) $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40) $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40) $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40) $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_MINIMIZE Case $msg = $GUI_EVENT_MAXIMIZE Case $msg = $button_1 WinActivate ("Earth") Case $msg = $button_2 WinActivate ("Water") Case $msg = $button_3 WinActivate ("Fire") Case $msg = $button_4 WinActivate ("Air") Case $Halt = $msg EndSelect WEnd EndFunc thanks a lot in advance Edited May 18, 2010 by Craberos Share this post Link to post Share on other sites
Yoriz 6 Posted May 18, 2010 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Earth") GUISetState(@SW_SHOW) GUICreate("Fire") GUISetState(@SW_SHOW) GUICreate("Air") GUISetState(@SW_SHOW) GUICreate("Water") GUISetState(@SW_SHOW) $aWindowPos = WinGetPos("Water") Global $Checkbox[4] #region ### START Koda GUI section ### Form= $Form1 = GUICreate("", 123, 120, $aWindowPos[0] - 145, -1) $Checkbox[0] = GUICtrlCreateCheckbox("Earth", 8, 8, 49, 17) $Checkbox[1] = GUICtrlCreateCheckbox("Fire", 64, 8, 49, 17) $Checkbox[2] = GUICtrlCreateCheckbox("Air", 8, 32, 49, 17) $Checkbox[3] = GUICtrlCreateCheckbox("Water", 64, 32, 49, 17) $Button1 = GUICtrlCreateButton("Activate Selected", 8, 56, 107, 25) $Button2 = GUICtrlCreateButton("Minimize All", 8, 88, 107, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then If Not WinActive($sTitle) Then WinActivate($sTitle) Else WinSetState($sTitle, "", @SW_MINIMIZE) EndIf Next Case $Button2 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) WinSetState($sTitle, "", @SW_MINIMIZE) GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED) Next EndSwitch WEnd GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Share this post Link to post Share on other sites
Craberos 0 Posted May 18, 2010 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Earth") GUISetState(@SW_SHOW) GUICreate("Fire") GUISetState(@SW_SHOW) GUICreate("Air") GUISetState(@SW_SHOW) GUICreate("Water") GUISetState(@SW_SHOW) $aWindowPos = WinGetPos("Water") Global $Checkbox[4] #region ### START Koda GUI section ### Form= $Form1 = GUICreate("", 123, 120, $aWindowPos[0] - 145, -1) $Checkbox[0] = GUICtrlCreateCheckbox("Earth", 8, 8, 49, 17) $Checkbox[1] = GUICtrlCreateCheckbox("Fire", 64, 8, 49, 17) $Checkbox[2] = GUICtrlCreateCheckbox("Air", 8, 32, 49, 17) $Checkbox[3] = GUICtrlCreateCheckbox("Water", 64, 32, 49, 17) $Button1 = GUICtrlCreateButton("Activate Selected", 8, 56, 107, 25) $Button2 = GUICtrlCreateButton("Minimize All", 8, 88, 107, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then If Not WinActive($sTitle) Then WinActivate($sTitle) Else WinSetState($sTitle, "", @SW_MINIMIZE) EndIf Next Case $Button2 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) WinSetState($sTitle, "", @SW_MINIMIZE) GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED) Next EndSwitch WEnd what you have done is great but not working for me ....... please can you look at my code below can you do that and this is what i want could anyone help me convert this script in to a checkbox version right now there are 4 buttons when i click on them an active window which is minimized with that name pops up ..... but i have to click them individually could anyone help me convert them to check box so if i select 3 and press a button they will pop up and stay cascaded and also a button to minimize all active windows and at the start of the programe open 4 files named "earth.txt,fire.txt,water.txt & air.txt" from the source directory so a total of 4 check boxes 2 buttons [1 for minimize all windows , 1 for after the selection of check boxes to say ok ] #include <GUIConstantsEx.au3> ShellExecute("Earth.txt",0) ShellExecute("Water.txt",0) ShellExecute("Air.txt",0) ShellExecute("Fire.txt",0) Opt('MustDeclareVars', 1) Example() Func Example() Local $button_1,$button_2, $button_3, $button_4 Local $Halt, $msg Opt("GUICoordMode", 1) GUICreate("T", 140, 260) $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40) $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40) $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40) $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_MINIMIZE Case $msg = $GUI_EVENT_MAXIMIZE Case $msg = $button_1 WinActivate ("Earth") Case $msg = $button_2 WinActivate ("Water") Case $msg = $button_3 WinActivate ("Fire") Case $msg = $button_4 WinActivate ("Air") Case $Halt = $msg EndSelect WEnd EndFunc Share this post Link to post Share on other sites
zorphnog 11 Posted May 18, 2010 (edited) I don't understand. What's wrong with @Yoriz's code? Should work fine.expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ShellExecute("Earth.txt",0) ShellExecute("Water.txt",0) ShellExecute("Air.txt",0) ShellExecute("Fire.txt",0) Global $Checkbox[4] #region ### START Koda GUI section ### Form= $Form1 = GUICreate("", 123, 120, -1, -1) $Checkbox[0] = GUICtrlCreateCheckbox("Earth", 8, 8, 49, 17) $Checkbox[1] = GUICtrlCreateCheckbox("Fire", 64, 8, 49, 17) $Checkbox[2] = GUICtrlCreateCheckbox("Air", 8, 32, 49, 17) $Checkbox[3] = GUICtrlCreateCheckbox("Water", 64, 32, 49, 17) $Button1 = GUICtrlCreateButton("Activate Selected", 8, 56, 107, 25) $Button2 = GUICtrlCreateButton("Minimize All", 8, 88, 107, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then If Not WinActive($sTitle) Then WinActivate($sTitle) Else WinSetState($sTitle, "", @SW_MINIMIZE) EndIf Next Case $Button2 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) WinSetState($sTitle, "", @SW_MINIMIZE) GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED) Next EndSwitch WEnd Edited May 18, 2010 by zorphnog Share this post Link to post Share on other sites
Craberos 0 Posted May 18, 2010 (edited) I don't understand. What's wrong with @Yoriz's code? Should work fine. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ShellExecute("Earth.txt",0) ShellExecute("Water.txt",0) ShellExecute("Air.txt",0) ShellExecute("Fire.txt",0) Global $Checkbox[4] #region ### START Koda GUI section ### Form= $Form1 = GUICreate("", 123, 120, -1, -1) $Checkbox[0] = GUICtrlCreateCheckbox("Earth", 8, 8, 49, 17) $Checkbox[1] = GUICtrlCreateCheckbox("Fire", 64, 8, 49, 17) $Checkbox[2] = GUICtrlCreateCheckbox("Air", 8, 32, 49, 17) $Checkbox[3] = GUICtrlCreateCheckbox("Water", 64, 32, 49, 17) $Button1 = GUICtrlCreateButton("Activate Selected", 8, 56, 107, 25) $Button2 = GUICtrlCreateButton("Minimize All", 8, 88, 107, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then If Not WinActive($sTitle) Then WinActivate($sTitle) Else WinSetState($sTitle, "", @SW_MINIMIZE) EndIf Next Case $Button2 For $i = 0 To 3 Step 1 $sTitle = GUICtrlRead($Checkbox[$i], 1) WinSetState($sTitle, "", @SW_MINIMIZE) GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED) Next EndSwitch WEnd thanks for the code zorphnog its perfect .......... Edited May 19, 2010 by Craberos Share this post Link to post Share on other sites