Jump to content

More Efficient


Recommended Posts

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_ <---

; ----  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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...