JohnBailey Posted March 8, 2007 Share Posted March 8, 2007 Is there a more efficient way to write the following script. The problem I have is the var name in the GUICtrlRead, so I couldn't think of a way to increment the number at the end of $Checkbox_ <--- expandcollapse popup; ---- days to run Global $daystoRunExport[8] ;0 to 7 = 8 $daystoRunExport[0] = 7 ;Monday If GUICtrlRead($Checkbox1) = 4 Then $daystoRunExport[1] = "1" Else $daystoRunExport[1] = "0" EndIf ;Tuesday If GUICtrlRead($Checkbox2) = 4 Then $daystoRunExport[2] = " 1" Else $daystoRunExport[2] = " 0" EndIf ;Wednesday If GUICtrlRead($Checkbox3) = 4 Then $daystoRunExport[3] = " 1" Else $daystoRunExport[3] = " 0" EndIf If GUICtrlRead($Checkbox4) = 4 Then $daystoRunExport[4] = " 1" Else $daystoRunExport[4] = " 0" EndIf If GUICtrlRead($Checkbox5) = 4 Then $daystoRunExport[5] = " 1" Else $daystoRunExport[5] = " 0" EndIf If GUICtrlRead($Checkbox6) = 4 Then $daystoRunExport[6] = " 1" Else $daystoRunExport[6] = " 0" EndIf If GUICtrlRead($Checkbox7) = 4 Then $daystoRunExport[7] = " 1" Else $daystoRunExport[7] = " 0" EndIf $daysAlphatoBinary = "" For $i = 1 to $daystoRunExport[0] $daysAlphatoBinary &= $daystoRunExport[$i] Next ;saving $b = GUICtrlRead($ProfileName) &" | "&$newRunTime&" | "&$newDate&" | "&$daysAlphatoBinary&" | "& GUICtrlRead($Input1) A decision is a powerful thing Link to comment Share on other sites More sharing options...
lod3n Posted March 8, 2007 Share Posted March 8, 2007 (edited) for $i = 1 to 7 If GUICtrlRead(eval("Checkbox"&$i)) = 4 Then $daystoRunExport[$i] = "1" Else $daystoRunExport[$i] = "0" EndIf next Edited March 8, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
JohnBailey Posted March 8, 2007 Author Share Posted March 8, 2007 for $i = 1 to 7 If GUICtrlRead(eval("Checkbox"&$i)) = 4 Then $daystoRunExport[$i] = "1" Else $daystoRunExport[$i] = "0" EndIf next Oh glorious day! Eval great idea! thanks lod3n! A decision is a powerful thing 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