Jump to content

Anyway to shorten...


Guest Deadphyre
 Share

Recommended Posts

Guest Deadphyre

I'm just doing a little side project to refresh my memory and I was wondering if there is anyway to shorten this portion of the code. Thank you in advance for any help I recieve.

If GUICtrlRead($January) = $GUI_CHECKED AND GUICtrlRead($February) = $GUI_UNCHECKED  AND GUICtrlRead($March) = $GUI_UNCHECKED AND GUICtrlRead($April) = $GUI_UNCHECKED AND GUICtrlRead($May) = $GUI_UNCHECKED AND GUICtrlRead($June) = $GUI_UNCHECKED AND GUICtrlRead($July) = $GUI_UNCHECKED AND GUICtrlRead($August) = $GUI_UNCHECKED AND GUICtrlRead($September) = $GUI_UNCHECKED AND GUICtrlRead($October) = $GUI_UNCHECKED AND GUICtrlRead($November) = $GUI_UNCHECKED AND GUICtrlRead($December) = $GUI_UNCHECKED THEN MsgBox(0, "GUI Event", "Temporary Button...January")
ExitLoop
Link to comment
Share on other sites

If GUICtrlRead($January) = $GUI_CHECKED AND GUICtrlRead($February) + GUICtrlRead($March) + GUICtrlRead($April) + GUICtrlRead($May) + GUICtrlRead($June) + GUICtrlRead($July) + GUICtrlRead($August) + GUICtrlRead($September) + GUICtrlRead($October) + GUICtrlRead($November) + GUICtrlRead($December) = $GUI_UNCHECKED * 11 THEN MsgBox(0, "GUI Event", "Temporary Button...January")
ExitLoop

If you had the months stored into an array then there are other ways.

/edit Another:

If _GCR($January) = $GUI_CHECKED AND _GCR($February) + _GCR($March) + _GCR($April) + _GCR($May) + _GCR($June) + _GCR($July) + _GCR($August) + _GCR($September) + _GCR($October) + _GCR($November) + _GCR($December) = $GUI_UNCHECKED * 11 THEN MsgBox(0, "GUI Event", "Temporary Button...January")
ExitLoop
Func _GCR($GCR_month)
    Return _GUICtrlRead($GCR_month)
EndFunc
Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

If   GUICtrlRead($January) = $GUI_CHECKED        AND _ 
    GUICtrlRead($February) = $GUI_UNCHECKED   AND _
    GUICtrlRead($March) = $GUI_UNCHECKED         AND _ 
    GUICtrlRead($April) = $GUI_UNCHECKED         AND _ 
    GUICtrlRead($May) = $GUI_UNCHECKED           AND _ 
    GUICtrlRead($June) = $GUI_UNCHECKED      AND _ 
    GUICtrlRead($July) = $GUI_UNCHECKED      AND _ 
    GUICtrlRead($August) = $GUI_UNCHECKED        AND _ 
    GUICtrlRead($September) = $GUI_UNCHECKED     AND _ 
    GUICtrlRead($October) = $GUI_UNCHECKED       AND _ 
    GUICtrlRead($November) = $GUI_UNCHECKED  AND _ 
    GUICtrlRead($December) = $GUI_UNCHECKED  THEN _ 
    MsgBox(0, "GUI Event", "Temporary Button...January")
EndIf

Meh, forums kinda messed it up, open this up in Scite:

test.au3

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

1) Are you using a bunch of checkboxes? You would probably want to replace them with a bunch of radio buttons. That way you only need to say If GUICtrlRead($January) = $GUI_CHECKED Then

2) Using individual variables for the months is probably a bad idea. Having an array called months with elements 1 to 12 would make a lot more sense.

3) Depending on what you are doing, it might make more sense to use a listbox--make sure to get rid of the alphabetical sorting style--with the months.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...