|| Operator not working for strings in conditional Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JimiJamz69

|| Operator not working for strings in conditional  Topic is solved

07 Jun 2017, 09:04

Hello all, I cannot seem to get this conditional to work. I've tried %%, == , "", "%%", `%`%, etc around the var but it won't work. I've noticed it will run without any ORs in the expression, but is there really no way for me to quickly check to see if it's one of these strings in the conditional expression?!

if (Legal = "Sole" || "Sol" || "Sol Prop" || "SP" || "DBA" || "Sole Proprietor")
{
MouseClick, Left, IndividualX, IndividualY, 1
}
else if (Legal = "C" || "C Corp" || "C Corporation")
{
MouseClick, Left, CorporationX, CorporationY, 1
}
else if (Legal = "S" || "S Corp" || "S Corporation")
{
MouseClick, Left, ScorpX, ScorpY, 1
}
else if (Legal = "LLC" || "Limited Liability Corporation")
{
MouseClick, Left, LLCx, LLCy, 1
}
else if (Legal = "Part" || "P" || "Partner" || "Partnership")
{
MouseClick, Left, PartnerX, PartnerY, 1
}
Else if (Legal = "Joint" || "Joint Venture" || "Like, when is it ever this?")
{
MouseClick, Left, JointX, JointY, 1
}
Else
{
MouseClick, Left, NonProfX, NonProfY, 1
}



Thanks for the help!
Jimi
User avatar
fischgeek
Posts: 435
Joined: 29 Jan 2014, 21:39

Re: || Operator not working for strings in conditional

07 Jun 2017, 09:28

Hello! Welcome to the forum. I moved your post to the Ask for Help section.

You had a great attempt! You just need to evaluate the condition each time.

Code: Select all

if (Legal == "Sole" || Legal == "Sol" || Legal == "Sol Prop" ...) ; and so on
Also, please place your code in

Code: Select all

 blocks when posting.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: || Operator not working for strings in conditional

07 Jun 2017, 09:34

I can infer from your code it was intuitive to present one variable and then name the possible things it could match. In this situation, you may be interested in If var in matchlist.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 343 guests