| View previous topic :: View next topic |
| Author |
Message |
silveredge78
Joined: 25 Jul 2006 Posts: 387 Location: Midwest, USA
|
Posted: Fri Aug 29, 2008 12:30 am Post subject: Bad if statement? - [Solved] |
|
|
So, I'm trying to do a comparison to do an incremental for another variable. The variable I am trying to compare with works in the first MsgBox, but doesn't work accordingly in the If/Else If/Else. It always just goes to the Else.
| Code: | MsgBox, % "Debug:`nVisitID: " . VisitID . "`nInsCat: " . %VisitID%InsCat
; Error right in here =========
QuickTest := %VisitID%InsCat
If QuickTest = 1 ; Or (%VisitID%InsCat = 5)
Code%Code%Type1++
Else If QuickTest = 2
Code%Code%Type2++
Else
MsgBox, Debug:`n InsCat was other than Type1/Type2. |
I originally had it as
| Code: | | If %VisitID%InsCat = 1 |
But switched to the QuickTest in case It was getting confused. Any help would be greatly appreciated as this is the last big hiccup at the moment! _________________ SilverEdge78
Last edited by silveredge78 on Fri Sep 05, 2008 4:47 pm; edited 1 time in total |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Fri Aug 29, 2008 12:36 am Post subject: |
|
|
Try this:
| Code: | MsgBox, % "Debug:`nVisitID: " . VisitID . "`nInsCat: " . %VisitID%InsCat
; Error right in here =========
If (%VisitID%InsCat = 1) ; Or (%VisitID%InsCat = 5)
Code%Code%Type1++
Else If (%VisitID%InsCat = 2)
Code%Code%Type2++
Else
MsgBox, Debug:`n InsCat was other than Type1/Type2. |
_________________ PlayAHK! Try it out  |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 387 Location: Midwest, USA
|
Posted: Fri Sep 05, 2008 3:20 pm Post subject: |
|
|
That is what I tried originally. For shits and giggles, I tried it again to no avail. What boggles my mind is that I use the exact same variable above and it works fine...
Any other ideas? _________________ SilverEdge78 |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 387 Location: Midwest, USA
|
Posted: Fri Sep 05, 2008 4:47 pm Post subject: |
|
|
Figured it out. Somehow there was a return at the end of that variable, thus it wasn't comparing as a number. Now it works! Thanks for the potential help. _________________ SilverEdge78 |
|
| Back to top |
|
 |
|