Docfxit Posted July 19, 2010 Posted July 19, 2010 (edited) I have an If statement that I am getting an error on. The error is on the Or statement If $title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files\Mozilla Firefox\" Or ;32bit $title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files(x86)\Mozilla Firefox\" Then ;64bit ;Something I do when it's correct ElseIf $title = "Mozilla Firefox Setup " And $TextLine[8] = $ProgramFiles & "FireFox\" Then ;Something I do when it's not correct Else ;It didn't find what it's supposed to EndIf Edited July 19, 2010 by docfxit
seandisanti Posted July 19, 2010 Posted July 19, 2010 I have an If statement that I am getting an error on. The error is on the Or statement If $title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files\Mozilla Firefox\" Or ;32bit $title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files(x86)\Mozilla Firefox\" Then ;64bit ;Something I do when it's correct ElseIf $title = "Mozilla Firefox Setup " And $TextLine[8] = $ProgramFiles & "FireFox\" Then ;Something I do when it's not correct Else ;It didn't find what it's supposed to EndIf may want to use parentheses to group your conditions, what exactly is the error you're getting?
Docfxit Posted July 19, 2010 Author Posted July 19, 2010 may want to use parentheses to group your conditions, what exactly is the error you're getting?Sorry I didn't include the exact wording. It says.Error: "If" statements must have a Then Keyword.It's stopping on the line with the Or at the end.Thanks,Docfxit
Docfxit Posted July 19, 2010 Author Posted July 19, 2010 (edited) I fixed two errors. If ($title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files\Mozilla Firefox\" Or ($title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files (x86)\Mozilla Firefox\") Then ;Something I do when it's correct ElseIf $title = "Mozilla Firefox Setup " And $TextLine[8] = $ProgramFiles & "FireFox\" Then ;Something I do when it's not correct Else ;It didn't find what it's supposed to EndIf One error I fixed is I put both lines onto one line. I guess I don't know how to continue a statement onto a second line. Second I didn't have a space before (x86) "C:\Program Files (x86)" It's fixed now. Thanks, Docfxit Edited July 19, 2010 by docfxit
somdcomputerguy Posted July 19, 2010 Posted July 19, 2010 (edited) ..I guess I don't know how to continue a statement onto a second line. Use & _ (ampersand, space, underscore) $string = "This is text that's not really too long, and, " & _ "This is more text" ConsoleWrite($string & @LF) ; This may work.. If ($title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files\Mozilla Firefox\" Or & _ ($title = "Mozilla Firefox Setup " And $TextLine[8] = "C:\Program Files (x86)\Mozilla Firefox\") Then Edited July 19, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Richard Robertson Posted July 19, 2010 Posted July 19, 2010 You only use the & when you want to concatenate two strings. _ alone is how you continue lines. It just has to be the last non-comment character on the line.
somdcomputerguy Posted July 19, 2010 Posted July 19, 2010 Thanks for clarifying. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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