Jump to content

Recommended Posts

Posted (edited)

I got a question with variables. I'm not even sure what to search for so I'm asking here.

I have two variables and I want to say if $var1 = 10 then $var2 should = 20 and if $var2 does not = 20 then do whatever. I'm having trouble with the "should" part... Can someone provide me a hint in the right direction. I just don't even know what to search for in the help file.

Edited by stbluesrul
Posted (edited)

check the help file on if...then statments.

here is an example:

If $var2 = 20 Then MsgBox(0, "test", "test")

or i might have misunderstood and if you want if $var1 And $var2 to be in there do this:

If $var1 = 10 And $var2 = 20 Then MsgBox(0, "test", "test")

and if you want if it dosent then you have to add an else.

If $var1 = 10 And $var2 = 20 Then
    MsgBox(0,"title","text")
Else
    MsgBox(4096,"title","win")
EndIf
Edited by pieeater

[spoiler]My UDFs: Login UDF[/spoiler]

Posted

I got this working:

If $sysmodelnumber = "HP 8100 Elite SFF" And $BIOS[1][17] = "786H1 v01.07" Then
    MsgBox(0, "test", "test")
ElseIf $sysmodelnumber = "HP 8100 Elite SFF" And $BIOS[1][17] = "" Then
    MsgBox(0, "BIOS", "BIOS is out of date")
EndIf

I just don't know what to put in for the $BIOS[1][17] = "" I want it to show that message box if that variable is anything but 786H1 v01.07. Make sense?

Thanks a bunch for your help.

Posted

Why are you doing the same comparison twice? Also, Helpfile > Language Reference > Operators.

If $BIOS[1][17] <> "786H1 v01.07" Then

Or make use of the Else-functionality in the If you are already doing.

If $sysmodelnumber = "HP 8100 Elite SFF" Then
    If $BIOS[1][17] = "786H1 v01.07" Then
        MsgBox(0, "test", "test")
    Else
        MsgBox(0, "BIOS", "BIOS is out of date")
    EndIf
EndIf
Posted

I got this working:

If $sysmodelnumber = "HP 8100 Elite SFF" And $BIOS[1][17] = "786H1 v01.07" Then
    MsgBox(0, "test", "test")
ElseIf $sysmodelnumber = "HP 8100 Elite SFF" And $BIOS[1][17] = "" Then
    MsgBox(0, "BIOS", "BIOS is out of date")
EndIf

I just don't know what to put in for the $BIOS[1][17] = "" I want it to show that message box if that variable is anything but 786H1 v01.07. Make sense?

Thanks a bunch for your help.

I figured it out.

If $sysmodelnumber = "HP 8100 Elite SFF" And $BIOS[1][17] = "786H1 v01.05" Then
ElseIf $sysmodelnumber = "HP 8100 Elite SFF" And $BIOS[1][17] <> "786H1 v01.05" Then
    MsgBox(0, "test", "test")
EndIf

Thanks for the help!

Posted

Or maybe just:

If ($sysmodelnumber = "HP 8100 Elite SFF") And (String($BIOS[1][17]) <> "786H1 v01.05") Then MsgBox(0, "test", "test")

You don't seem to need any of the ELSE conditions.

:huh2:

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

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
  • Recently Browsing   0 members

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