Page 1 of 1

If Var1 = "A"

Posted: 23 Feb 2023, 05:13
by Lo4438

Code: Select all

If Var1 = "A"
{Msgbox, "yes"}
Can anyone tell me if this is right?

Re: If Var1 = "A"

Posted: 23 Feb 2023, 05:50
by Scr1pter

Code: Select all

F1::
if Var1 = "A"
{
  Msgbox, "yes"
}
return
Keep in mind that if Var1 = A can also be correct,
depending on how the exact value is.

Var1 = "A" and Var1 = A is not the same

Cheers

Re: If Var1 = "A"

Posted: 23 Feb 2023, 05:56
by Scr1pter
Edit:
Sorry, this is now AHK v2 section.

So I can't guarantee for my post ;)

Re: If Var1 = "A"

Posted: 23 Feb 2023, 07:36
by mikeyww

Code: Select all

#Requires AutoHotkey v2.0
Var1 := "A"
If Var1 = "A"
 MsgBox "Yes"

Re: If Var1 = "A"

Posted: 23 Feb 2023, 07:59
by boiler
@Lo4438 — It looks like you probably are using AHK v1. Is that correct? If so, I’ll move this to the appropriate forum as we have just reorganized them to make the main sections for v2 (and may rename them to make it more clear).

Re: If Var1 = "A"

Posted: 23 Feb 2023, 08:02
by mikeyww
For clarity in v1:

Code: Select all

#Requires AutoHotkey v1.1.33
Var1 := "A"
If (Var1 = "A")
 Msgbox Yes

Re: If Var1 = "A"

Posted: 23 Feb 2023, 09:02
by Lo4438
Thx for your answer, brother.
I just use v1.
Ihave other problem, how to convert "A" to a text?

Re: If Var1 = "A"

Posted: 23 Feb 2023, 09:11
by mikeyww
"A" indicates a text letter.

Re: If Var1 = "A"

Posted: 23 Feb 2023, 10:13
by boiler
Moved thread to v1 section.