How to identify that which condition gone true?
suppose,
a=apple
b=2
If (a="apple" || b="boll")
Msgbox True
in this How to identify by script that which condition gone true to reach the msgbox, by user?
1. by apple (first condition)
2. by boll (second condition)
how to identify conditions
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
how to identify conditions
Last edited by MonuKashyap on 29 May 2018, 07:19, edited 1 time in total.
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: how to identify conditions
Play with this, I think it can help youMonuKashyap wrote:How to identify the condition gone true?
suppose,
a=apple
b=2
If (a="apple" || b="boll")
Msgbox True
in this How to identify by script that which condition gone true to reach the msgbox, by user?
1. by apple (first condition)
2. by boll (second condition)
Code: Select all
a = apple
b = 2
if (a = "apple" and b = "2")
msgbox, it's true
else
msgbox, % "It's not true because a = " a " and b = " b
ExitApp
-
- Posts: 44
- Joined: 18 Aug 2016, 22:56
Re: how to identify conditions
i would say, if you need to know which argument caused the ''true' condition, you need to restructure your code and use individual "if" statements.
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
Re: how to identify conditions
How do i do that?imustbeamoron wrote:i would say, if you need to know which argument caused the ''true' condition, you need to restructure your code and use individual "if" statements.
where both conditions are variable
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
Re: how to identify conditions
AHKStudent wrote:Play with this, I think it can help youMonuKashyap wrote:How to identify the condition gone true?
suppose,
a=apple
b=2
If (a="apple" || b="boll")
Msgbox True
in this How to identify by script that which condition gone true to reach the msgbox, by user?
1. by apple (first condition)
2. by boll (second condition)
Code: Select all
a = apple b = 2 if (a = "apple" and b = "2") msgbox, it's true else msgbox, % "It's not true because a = " a " and b = " b ExitApp
No my dear friend, I want to know which condition causes to get in to the program for user, condition apple or condition ball. How do i identify that?
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: how to identify conditions
here is a noob way of doing itMonuKashyap wrote:AHKStudent wrote:Play with this, I think it can help youMonuKashyap wrote:How to identify the condition gone true?
suppose,
a=apple
b=2
If (a="apple" || b="boll")
Msgbox True
in this How to identify by script that which condition gone true to reach the msgbox, by user?
1. by apple (first condition)
2. by boll (second condition)
Code: Select all
a = apple b = 2 if (a = "apple" and b = "2") msgbox, it's true else msgbox, % "It's not true because a = " a " and b = " b ExitApp
No my dear friend, I want to know which condition causes to get in to the program for user, condition apple or condition ball. How do i identify that?
Code: Select all
a = apple
b = 2
if (a != "apple")
achanged := 2
if (b != "2")
bchanged := 2
if (achanged = "2" and bchanged = "2")
msgbox, Both changed
if (achanged = "2" and bchanged = "")
msgbox, % "a is no longer apple, it's now " a
if (bchanged = "2" and achanged = "" )
msgbox, % "b is no longer 2, it's now " b
if (a = "apple" and b = "2")
msgbox, Nothing changed
ExitApp
Re: how to identify conditions
Code: Select all
compare(a, b) {
if (a = "apple")
MsgBox, % "a determined the result"
else if (b = 2)
MsgBox, % "b determined the result"
else
MsgBox, % "neither is true"
}
a := "apple", b := 2, compare(a, b)
a := "orange", b := 2, compare(a, b)
a := "kiwi", b := 100, compare(a, b)
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
Re: how to identify conditions
Well i am something looking like that :-
a=pwd1
b=pwd2
inputbox, InputByUser
if (InputByUser=pwd1 || InputByUser=pwd2)
; if the condition goes true, by condition1 i.e. entering pwd1 then,
msgbox The user get loged in by by condition1
; and if the condition goes true, by condition2 i.e. entering pwd2 then
msgbox The user get logged in by condition2
The problem is that the pwd1 and pwd2 are variable, can be changed any time
any suggestion ??
and i know the single if condition can do it, but it is more simple and easy if the "If with Or" condition could do that.
a=pwd1
b=pwd2
inputbox, InputByUser
if (InputByUser=pwd1 || InputByUser=pwd2)
; if the condition goes true, by condition1 i.e. entering pwd1 then,
msgbox The user get loged in by by condition1
; and if the condition goes true, by condition2 i.e. entering pwd2 then
msgbox The user get logged in by condition2
The problem is that the pwd1 and pwd2 are variable, can be changed any time
any suggestion ??
and i know the single if condition can do it, but it is more simple and easy if the "If with Or" condition could do that.
Re: how to identify conditions
thats what the function does already, just extract its body and change the variable names accordingly
-
- Posts: 112
- Joined: 06 Jun 2016, 21:32
Re: how to identify conditions
Can you please explain How??swagfag wrote:thats what the function does already, just extract its body and change the variable names accordingly
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 119 guests