Jump to content
Sign in to follow this  
stbluesrul

Variables question

Recommended Posts

stbluesrul

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

Share this post


Link to post
Share on other sites
pieeater

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]

Share this post


Link to post
Share on other sites
stbluesrul

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.

Share this post


Link to post
Share on other sites
AdmiralAlkex

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

Share this post


Link to post
Share on other sites
stbluesrul

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!

Share this post


Link to post
Share on other sites
PsaltyDS

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

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  

×