stbluesrul Posted June 8, 2011 Posted June 8, 2011 (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 June 8, 2011 by stbluesrul
pieeater Posted June 8, 2011 Posted June 8, 2011 (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 June 8, 2011 by pieeater [spoiler]My UDFs: Login UDF[/spoiler]
stbluesrul Posted June 9, 2011 Author Posted June 9, 2011 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.
AdmiralAlkex Posted June 9, 2011 Posted June 9, 2011 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 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
stbluesrul Posted June 9, 2011 Author Posted June 9, 2011 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!
PsaltyDS Posted June 9, 2011 Posted June 9, 2011 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. 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now