Jump to content
Sign in to follow this  

Variable assignment question

Recommended Posts

Is there a more compact method of doing this?

if GUICtrlRead($gain) == $GUI_CHECKED then
    $replaygain = 1
    $replaygain = 0

I have many such statements in my script, which adds up to quite a bit of wasted space. Is there some alternative method I could do this so that each and ever assignment statement doesn't take 5 lines?

Eg, in PHP I could do this:

if (GUICtrlRead($gain)) == $GUI_CHECKED) $replaygain = 1;
else $replaygain = 0;

or even better:

GUICtrlRead($gain) == $GUI_CHECKED ? $replaygain = 1 : $replaygain = 0;

Of course, this isn't PHP, but I was wondering if there was some more optimal way of coding this.


Edited by nitro322

Share this post

Link to post
Share on other sites

Assuming your using GUIGetMsg() and this is in the loop you could try this:

While 1
    $Msg = GUIGetMsg()
    If $Msg = $gain And BitAND(GUICtrlRead($gain), $GUI_CHECKED) = $GUI_CHECKED Then $replaygain = 1
    If $Msg = $gain And BitAND(GUICtrlRead($gain), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $replaygain = 0

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...