AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bad if statement? - [Solved]

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
silveredge78



Joined: 25 Jul 2006
Posts: 387
Location: Midwest, USA

PostPosted: Fri Aug 29, 2008 12:30 am    Post subject: Bad if statement? - [Solved] Reply with quote

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
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Fri Aug 29, 2008 12:36 am    Post subject: Reply with quote

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 Very Happy
Back to top
View user's profile Send private message AIM Address
silveredge78



Joined: 25 Jul 2006
Posts: 387
Location: Midwest, USA

PostPosted: Fri Sep 05, 2008 3:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
silveredge78



Joined: 25 Jul 2006
Posts: 387
Location: Midwest, USA

PostPosted: Fri Sep 05, 2008 4:47 pm    Post subject: Reply with quote

Figured it out. Somehow there was a return at the end of that variable, thus it wasn't comparing as a number. Smile Now it works! Thanks for the potential help.
_________________
SilverEdge78
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group