WesW Posted March 7, 2011 Share Posted March 7, 2011 Hello... I am trying to install apps using checkboxes. The first checkbox works fine, but the second one is not working.... Any thoughts #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows 7 - V8i Build", 242, 403, 188, 124) $Checkbox1 = GUICtrlCreateCheckbox("Startup.exe", 16, 8, 113, 35) $Checkbox2 = GUICtrlCreateCheckbox("AutoCAD 2010", 16, 40, 113, 35) $Checkbox3 = GUICtrlCreateCheckbox("AutoCAD 2010 Update 2", 16, 69, 153, 35) $Checkbox4 = GUICtrlCreateCheckbox("ProjectWise Explorer (Client) 443", 16, 106, 209, 35) $Checkbox5 = GUICtrlCreateCheckbox("PWEseeder .exe", 16, 144, 113, 35) $Checkbox6 = GUICtrlCreateCheckbox("PID", 16, 183, 113, 35) $Checkbox7 = GUICtrlCreateCheckbox("PRINS", 16, 221, 113, 35) $Checkbox8 = GUICtrlCreateCheckbox("AutoPLANT Plant Design", 16, 260, 185, 35) $Checkbox9 = GUICtrlCreateCheckbox("ProStructures.SS3", 16, 298, 113, 35) $Button1 = GUICtrlCreateButton("Run/Install", 56, 344, 105, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If BitAND(GUICtrlRead($Checkbox1), 1) Then Run("Install Path.exe") Case $Button1 If BitAND(GUICtrlRead($Checkbox2), 1) Then Run("Install path.exe") EndSwitch WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 7, 2011 Share Posted March 7, 2011 Uhmm, perhaps you meant your second Case to be $Button2 instead of $Button1 again... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
WesW Posted March 7, 2011 Author Share Posted March 7, 2011 Thanks for your reply... But the checkbox is named ($Checkbox2). Case $Button1 If BitAND(GUICtrlRead($Checkbox2), 1) Then Run("Install path.exe") Link to comment Share on other sites More sharing options...
BrewManNH Posted March 7, 2011 Share Posted March 7, 2011 (edited) Case will go to the first match it finds, so the second, and any other comparisons using $Button1, won't ever be seen. You should probably do something like this put your checkboxes in an array and loop through the array to see which ones are checked. Edited March 7, 2011 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
WesW Posted March 7, 2011 Author Share Posted March 7, 2011 I found this code, but I am not sure how to format the code to meet my needs. any thoughts #include <GUIConstantsEx.au3> Global $Form1, $Button1, $aCheckbox[5], $nMsg $Form1 = GUICreate("Form1", 185, 185, 192, 124) $Button1 = GUICtrlCreateButton("Install", 8, 160, 107, 25) For $i = 0 To UBound($aCheckbox) - 1 $aCheckbox[$i] = GUICtrlCreateCheckbox("Bentley Install#" & $i + 1, 8, ($i * 20) + 20, 97, 17) Next GUISetState(@SW_SHOW, $Form1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To UBound($aCheckbox) - 1 If BitAND(GUICtrlRead($aCheckbox[$i]), $GUI_CHECKED) Then MsgBox(4096, "Install", "Done" & $i + 1) Next EndSwitch WEnd Link to comment Share on other sites More sharing options...
BrewManNH Posted March 7, 2011 Share Posted March 7, 2011 Try this as a demo: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows 7 - V8i Build", 242, 403, 188, 124) Global $Programs[9] = ["Startup.exe", "AutoCAD 2010", "AutoCAD 2010 Update 2", "ProjectWise Explorer (Client) 443", "PWEseeder .exe", "PID", "PRINS", "AutoPLANT Plant Design", "ProStructures.SS3"] Global $Checkbox[9] For $I = 0 To 8 $Checkbox[$I] = GUICtrlCreateCheckbox($Programs[$I], 16, $I * 30, 113, 35) Next $Button1 = GUICtrlCreateButton("Run/Install", 56, 344, 105, 33) 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 8 If BitAND(GUICtrlRead($Checkbox[$I]), $GUI_Checked) Then ConsoleWrite("!You checked box " & $I & " that will install " & $Programs[$I] & @LF) Next EndSwitch WEnd If you replace the MsgBox function with code that can run your programs, you should be able to go from here. Run this in SciTE and see the results in the console output if it's not clear what's going on. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
WesW Posted March 7, 2011 Author Share Posted March 7, 2011 Thanks for the reply... can you please give me an example of how to list the install path. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows 7 - V8i Build", 242, 403, 188, 124) Global $Programs[9] = ["Startup.exe", "AutoCAD 2010", "AutoCAD 2010 Update 2", "ProjectWise Explorer (Client) 443", "PWEseeder .exe", "PID", "PRINS", "AutoPLANT Plant Design", "ProStructures.SS3"] Global $Checkbox[9] For $I = 0 To 8 $Checkbox[$I] = GUICtrlCreateCheckbox($Programs[$I], 16, $I * 30, 113, 35) Next $Button1 = GUICtrlCreateButton("Run/Install", 56, 344, 105, 33) 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 8 If BitAND(GUICtrlRead($Checkbox[$I]), $GUI_Checked) Then ConsoleWrite("!You checked box " & $I & " that will install " & $Programs[$I] & @LF) Next EndSwitch WEnd Link to comment Share on other sites More sharing options...
omikron48 Posted March 8, 2011 Share Posted March 8, 2011 You can just modify to look the way you want, or you can just use it as is. Link to comment Share on other sites More sharing options...
WesW Posted March 8, 2011 Author Share Posted March 8, 2011 (edited) Thanks very much for the help. I would like to use what I have so i can learn the steps involved. Can someone please give me an example of how to list the install path. Edited March 8, 2011 by WesW Link to comment Share on other sites More sharing options...
Chimaera Posted March 8, 2011 Share Posted March 8, 2011 (edited) Im in a similar position i have these $check_1 = GUICtrlCreateCheckbox(" Save All User Files", 30, 160) $check_2 = GUICtrlCreateCheckbox(" Save Database Files", 30, 190) $check_3 = GUICtrlCreateCheckbox(" Save CadCam Files", 30, 220) $Button1 = GUICtrlCreateButton("Start Backup", 56, 344, 105, 33) and they all have to run one of these Func _backup_all() Local $back_files = '"*.*"' Local $exclude_files = '"*.lnk"' Local $exclude_folders = '"$Recycle.Bin", "Apple*"' Local $test = _robocopy($source, $target, /NJS", $back_files, $exclude_files, $exclude_folders, "", "") Sleep(200) EndFunc Func _backup_database()etc etc Func _backup_database()etc etc obviously these are not complete but i need when the checkboxes and button are pressed the it starts the functions that have been selected one after another. most of the examples are to do with making checkboxes in arrays etc where i have a set of functions that have to be accessed So i assume i need to alter this in some way While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $I = 0 To 8 If BitAND(GUICtrlRead($Checkbox[$I]), $GUI_Checked) Then ConsoleWrite("!You checked box " & $I & " that will install " & $Programs[$I] & @LF) Next EndSwitch WEnd specifically this bit to run the functions Then ConsoleWrite("!You checked box " & $I & " that will install " & $Programs[$I] & @LF) So how do i say Run all functions that are checked in $I Edited March 8, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2011 Share Posted March 8, 2011 (edited) Something like this perhaps?Local $aRunArray[9][2] = [[0, 2]] ; Change 9 to the Number of Checkboxes e.g. 8 + 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To 8 If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_Checked) Then $aRunArray[0][0] += 1 $aRunArray[$aRunArray[0][0]][0] = $Checkbox[$i] ; ControlID. $aRunArray[$aRunArray[0][0]][1] = $Programs[$i] ; ProgramName or Location. ConsoleWrite("!You checked box " & $i & " that will install " & $Programs[$i] & @LF) EndIf Next _Run($aRunArray) EndSwitch WEnd Func _Run($aArray) If Not IsArray($aArray) Or $aArray[0][0] = 0 Then Return SetError(1, 0, 0) For $i = 1 To $aArray[0][0] RunWait($aArray[$i][1]) If Not @error Then GUICtrlSetState($aArray[$i][0], $GUI_UNCHECKED) ; UnCheck. Next If Not @error Then Return 1 Return SetError(1, 0, 0) EndFunc ;==>_RunNote: Not tested! This is purely an Example and of course has room for improvement. Edited March 8, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
WesW Posted March 8, 2011 Author Share Posted March 8, 2011 THis looks great.... How do I call out each checkbox with it's own install path? Thanks for your help. Something like this perhaps? LLocal $aRunArray[9][2] = [[0, 2]] ; Change 9 to the Number of Checkboxes e.g. 8 + 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To 8 If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_Checked) Then $aRunArray[0][0] += 1 $aRunArray[$aRunArray[0][0]][0] = $Checkbox[$i] ; ControlID. $aRunArray[$aRunArray[0][0]][1] = $Programs[$i] ; ProgramName or Location. ConsoleWrite("!You checked box " & $i & " that will install " & $Programs[$i] & @LF) EndIf Next _Run($aRunArray) EndSwitch WEnd Func _Run($aArray) If Not IsArray($aArray) Or $aArray[0][0] = 0 Then Return SetError(1, 0, 0) For $i = 1 To $aArray[0][0] RunWait($aArray[$i][1]) If Not @error Then GUICtrlSetState($aArray[$i][0], $GUI_UNCHECKED) ; UnCheck. Next If Not @error Then Return 1 Return SetError(1, 0, 0) EndFunc ;==>_Run Note: Not tested! This is purely an Example and of course has room for improvement. Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2011 Share Posted March 8, 2011 (edited) Edited the previous post because I misspelled Local You could have a CheckBox with the name as the Install Path and then use GUICtrlRead() OR utilise an Array containing the Install Paths. Probably best to see how Chimaera would do it GUICtrlRead($Checkbox, 1) Edited March 8, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted March 8, 2011 Share Posted March 8, 2011 (edited) The problem i have is this expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows 7 - V8i Build", 242, 403, 188, 124) Global $Programs[10] = ["Save All User Files", "Save Database Files", "Save CadCam Files", "Save Backup Files"] Global $Checkbox[10] For $I = 0 To 9 $Checkbox[$I] = GUICtrlCreateCheckbox($Programs[$I], 36, $I * 30, 113, 35) Next #cs $check_1 = GUICtrlCreateCheckbox(" Save All User Files", 30, 160) <<<<< $check_2 = GUICtrlCreateCheckbox(" Save Database Files", 30, 190) <<<<< $check_3 = GUICtrlCreateCheckbox(" Save CadCam Files", 30, 220) <<<<< $check_4 = GUICtrlCreateCheckbox(" Save Backup Files", 30, 250) <<<<< #ce $Button1 = GUICtrlCreateButton("Run/Install", 56, 344, 105, 33) 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 9 If BitAND(GUICtrlRead($Checkbox[$I]), $GUI_Checked) Then _Install($I) Next EndSwitch WEnd ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Func _Install($Program) If $Program = 0 Then _choice_1() ElseIf $Program = 1 Then _choice_2() EndIf EndFunc ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Func _choice_1() MsgBox(4096, "Install", "App1") EndFunc Func _choice_2() MsgBox(4096, "Install", "App2") EndFunc I understand the $Programs [10] is setting out the array of the items which is fine but this bit $Checkbox[$I] = GUICtrlCreateCheckbox($Programs[$I], 36, $I * 30, 113, 35) is doing my head in because of the auto assigned display its fine as an example but i have a header and other bits i need it in a specific location hence why i had done this origanally $check_1 = GUICtrlCreateCheckbox(" Save All User Files", 30, 160) <<<<< $check_2 = GUICtrlCreateCheckbox(" Save Database Files", 30, 190) <<<<< $check_3 = GUICtrlCreateCheckbox(" Save CadCam Files", 30, 220) <<<<< $check_4 = GUICtrlCreateCheckbox(" Save Backup Files", 30, 250) <<<<< Its this bit that causes the problem as an auto assigned gap between each heading $I * 30 i need to be able to get it a set distance from the top then have it auto assign... Or I need it to use my predefined list eg $check_1, $check_2 etc Can someone sort this as im getting pissed off trying stuff and it not working Ive tried making an array at the $Programs [10] bit ive tried diff combos at the $I bit ie 200 + $I * 30 or 200 & $I * 30 and loads of other bits but cant seem to find the right way Any help please Edited March 8, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2011 Share Posted March 8, 2011 (edited) OK, firstly you didn't mention this in your OP...I believe this was the original problem. So how do i say Run all functions that are checked in $ISecondly, why not use a 2D Array with the "predefined" gaps e.g. I have changed things a little! expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows 7 - V8i Build", 242, 403, 188, 124) Global $Programs[5][2] = [[4, 2],["Save All User Files", 160],["Save Database Files", 190],["Save CadCam Files", 220],["Save Backup Files", 250]] Global $Checkbox[$Programs[0][0] + 1] For $i = 1 To $Programs[0][0] $Checkbox[$i] = GUICtrlCreateCheckbox($Programs[$i][0], 30, $Programs[$i][1], 113, 35) Next #cs $check_1 = GUICtrlCreateCheckbox(" Save All User Files", 30, 160) ;<<<<< $check_2 = GUICtrlCreateCheckbox(" Save Database Files", 30, 190) ;<<<<< $check_3 = GUICtrlCreateCheckbox(" Save CadCam Files", 30, 220) ;<<<<< $check_4 = GUICtrlCreateCheckbox(" Save Backup Files", 30, 250) ;<<<<< #ce $Button1 = GUICtrlCreateButton("Run/Install", 56, 344, 105, 33) 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 $Programs[0][0] If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_Checked) Then _Install($i) Next EndSwitch WEnd ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Func _Install($Program) If $Program = 0 Then _choice_1() ElseIf $Program = 1 Then _choice_2() EndIf EndFunc ;==>_Install ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Func _choice_1() MsgBox(4096, "Install", "App1") EndFunc ;==>_choice_1 Func _choice_2() MsgBox(4096, "Install", "App2") EndFunc ;==>_choice_2 Edit: Apologies WesW for "hijacking" your thread! Edited March 8, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted March 8, 2011 Share Posted March 8, 2011 lol ive never used a 1D array never mind a 2, thanks for the help and i think we have kept within the topic but thanks to WesW for asking the questions If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2011 Share Posted March 8, 2011 (edited) lol ive never used a 1D array never mind a 2Maybe have a look at the Wiki Entry to get accustomed with Arrays. Did my Example eventually solve your problem? You didn't make it clear Edited March 8, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
WesW Posted March 8, 2011 Author Share Posted March 8, 2011 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows 7 - V8i Build", 272, 442, 192, 124) $Button1 = GUICtrlCreateButton("Install", 16, 16, 49, 25) $Button2 = GUICtrlCreateButton("Install", 16, 60, 49, 25) $Button3 = GUICtrlCreateButton("Install", 16, 105, 49, 25) $Button4 = GUICtrlCreateButton("Install", 16, 150, 49, 25) $Button5 = GUICtrlCreateButton("Install", 16, 194, 49, 25) $Button6 = GUICtrlCreateButton("Install", 16, 238, 49, 25) $Button7 = GUICtrlCreateButton("Install", 16, 283, 49, 25) $Button8 = GUICtrlCreateButton("Install", 16, 328, 49, 25) $Button9 = GUICtrlCreateButton("Install", 16, 372, 49, 25) $Label1 = GUICtrlCreateLabel("Startup.exe", 72, 24, 58, 17) $Label2 = GUICtrlCreateLabel("AutoCAD 2010 Update 2", 72, 112, 122, 17) $Label3 = GUICtrlCreateLabel("ProjectWise Explorer (Client) 443", 72, 152, 158, 17) $Label4 = GUICtrlCreateLabel("PWEseeder .exe", 72, 200, 84, 17) $Label5 = GUICtrlCreateLabel("PID", 72, 248, 22, 17) $Label6 = GUICtrlCreateLabel("PRINS", 72, 288, 37, 17) $Label7 = GUICtrlCreateLabel("AutoPLANT Plant Design", 72, 336, 124, 17) $Label8 = GUICtrlCreateLabel("ProStructures.SS3", 72, 376, 91, 17) $Label9 = GUICtrlCreateLabel("AutoCAD 2010", 72, 64, 75, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("calc.exe") Case $Button2 Run("calc.exe") Case $Button3 Run("calc.exe") Case $Button4 Run("calc.exe") Case $Button5 Run("calc.exe") Case $Button6 Run("calc.exe") Case $Button7 Run("calc.exe") Case $Button8 Run("calc.exe") Case $Button9 Run("calc.exe") EndSwitch WEndI have learned alot. Thanks very much for all the help. I am going a different way. The checkboxes are confusing a few people that need to install the software. I am setting this up so it will be easier for them. Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2011 Share Posted March 8, 2011 (edited) The checkboxes are confusing a few peopleReally? What was the problem? BrewManNH's Example seemed pretty helpful. Edited March 8, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2011 Share Posted March 8, 2011 I had a quick 2 minutes to spare, is this what you wanted? >> #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $GUI = GUICreate("Windows 7 - V8i Build", 242, 403, 188, 124) Global $aPrograms[5][2] = [[4, 2],["Install CAD", @ScriptDir & "\CAD.exe"],["Install Flash", @ScriptDir & "\Flash.exe"],["Install Opera", @ScriptDir & "\Opera.exe"],["Install Firefox", @ScriptDir & "\Firefox.exe"]] Global $aCheckbox[$aPrograms[0][0] + 1] For $i = 1 To $aPrograms[0][0] $aCheckbox[$i] = GUICtrlCreateCheckbox($aPrograms[$i][0], 30, ($i - 1) * 30, 113, 35) Next Global $Button = GUICtrlCreateButton("Run/Install", 56, 344, 105, 33) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button For $i = 0 To $aPrograms[0][0] If BitAND(GUICtrlRead($aCheckbox[$i]), $GUI_Checked) Then _Install($aPrograms[$i][1]) Next EndSwitch WEnd Func _Install($sPath) ConsoleWrite("Install >> " & $sPath & @CRLF) ;~ RunWait($sPath) EndFunc ;==>_Install UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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