Problems with having 2 exact variables being not the same.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Anfly
Posts: 12
Joined: 10 Sep 2022, 16:47

Problems with having 2 exact variables being not the same.

Post by Anfly » 27 Nov 2022, 19:12

Hello! I have 2 variables that I need to check if they are the same, but the problem is that whenever i run a if loop to check, they are never the same. Here is a part of my code :

Code: Select all

IniRead,keyVID,C:\Users\Anfly\Desktop\checkingthis.ini, Keyboard, vid
IniRead,keyPID,C:\Users\Anfly\Desktop\checkingthis.ini, Keyboard, pid
Gui Add, Button, gUpdate x8 y56 w94 h23, Update
Gui Add, Edit, vVID_var x248 y312 w53 h21, %keyVID%
Gui Add, Edit, vPID_var x328 y312 w53 h21, %keyPID%
Gui Show, w730 h368, checker
return

Update:
Gui, Submit, Nohide
GuiControlGet,CurrentVID,1:,VID_var
GuiControlGet,CurrentPID,1:,PID_var
VID := 0x03F0
if VID = CurrentVID
    tooltip, the same
else
tooltip, not the same
Return

It always tell me they are not the same, even though i have checked that they are, any help?

User avatar
boiler
Posts: 16932
Joined: 21 Dec 2014, 02:44

Re: Problems with having 2 exact variables being not the same.

Post by boiler » 27 Nov 2022, 19:22

Your problem is syntax. You are using the legacy version of if, so it needs to be:

Code: Select all

if VID = %CurrentVID%

Or you can use the expression version of if:

Code: Select all

if (VID = CurrentVID)

Post Reply

Return to “Ask for Help (v1)”