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 

Need help with Not Equal function

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



Joined: 01 Oct 2007
Posts: 17

PostPosted: Fri Feb 01, 2008 3:20 am    Post subject: Need help with Not Equal function Reply with quote

I have a quirky problem I just can't seem to solve. I have a program within which has a button which allows users to switch projects by going to another program to select the project, then return to my program to continue the script. At one GUI, there's a button named "Change". This sets a flag variable (Change = 1) and uses GoSub which is the following code:
Code:
RunDriveMap:
If Mapper = Newforma
{
SetTitleMatchMode 2
IfWinExist, Newforma Project Center
   WinActivate
else
   Run, %ProgramFiles%\Newforma\Fourth Edition\Project Center\ProjectCenter.exe
If Change ;if launched from Change button, must wait til registry changes
{
   Loop
   {
   Sleep, 2000
   RegRead, NewNum, HKEY_CURRENT_USER, Software\Newforma\Fourth Edition\RecentProjects\RecentProject0, ProjectNumber
   msgbox, Change flag is %Change%`nOld Project Num is %PrjNum%`nNew Project Name is %NewNum%
   IfNotEqual, NewNum, PrjNum ;if the new number is different, break the loop
   { 
   msgbox, NewNum - %NewNum%`nOldNum - %PrjNum%`nLoop is broken
   break
   }
   }
return
}
else
{
Loop
{
   Sleep, 2000
   IfExist, W:\
      break
}
return
}
}


The problem is the comparison of NewNum versus PrjNum (the existing project number grabbed in an earlier part of the program. The msgbox I created in the RegRead loop above shows this:

Looks like the project numbers are equal yet it breaks the loop. I'd appreciate the help!

Regards,
James
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 582
Location: MN, USA

PostPosted: Fri Feb 01, 2008 3:34 am    Post subject: Reply with quote

Instead of
Code:
IfNotEqual, NewNum, PrjNum

try
Code:
IfNotEqual, NewNum, %PrjNum%



Help File wrote:
IfNotEqual, var, value

Variables don't need % signs; values do.
_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
ManaUser



Joined: 24 May 2007
Posts: 904

PostPosted: Fri Feb 01, 2008 3:57 am    Post subject: Reply with quote

That's fine if you prefer doing it that way, but I recommend staying away from the special Ifs when possible. An Expression If can be used in all cases. An Expression If is any If followed by parenthesis or a function. In your case that would be:
Code:
If (NewNum != PrjNum)
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