Page 1 of 1

Variables

Posted: 30 Dec 2016, 12:58
by fedek
gg:=Добро
if !(gg contains Вход or Добро)
MsgBox +
ExitApp

Why + ?

Re: Variables

Posted: 30 Dec 2016, 13:14
by garry
msgbox + if contains

Code: Select all

gg=Добро
if gg contains Вход,Добро
MsgBox +
ExitApp
or not contains

Code: Select all

gg=Добро
if gg not contains Вход,Добро
MsgBox +
ExitApp

Re: Variables

Posted: 30 Dec 2016, 13:19
by fedek
Thanks. There is another question:
gg:=ттт
if gg != ууу1,contains еее
MsgBox 1
ExitApp

Why 1 ?

Re: Variables

Posted: 30 Dec 2016, 14:06
by garry
see also some examples with AND / OR etc
and also INSTR , Regex...

Code: Select all

g1:="TTT"
g2:="AAA"
if (g1 ="TTT" and g2 = "AAA" )
  MsgBox,(g1 ="TTT" and g2 = "AAA" )

if (g1 ="TTT" or g2 != "AAC" )
  MsgBox,(g1 ="TTT" or g2 != "AAC" )

if (g1 ="TTT" and g2 = "AAC" )
  MsgBox,CASE-1
else
  MsgBox,CASE-2
ExitApp



/*
;- if GG containsx Instrxx
If InStr( GG, "by:" ) || InStr( GG, "CCCC" ) || InStr( GG, "Summar" ) || InStr( GG, " " )
    Continue

;-or also

If GG Contains by:,CCCC, ,Summar
    Continue
;-or

If ( RegExMatch(GG, "i)" . "by:|CCCC| |Summar") )      ;- "i)" means "Case-Insensitive"
    Continue

;-or


If ( GG ~= "(?i:" . "by:|CCCC| |Summar" . ")" )         ;- "?i:" means "Case-Insensitive"
    Continue
*/

Re: Variables

Posted: 01 Jan 2017, 18:02
by lexikos
fedek,

You must use the syntax shown and explained in the manual:
if Var contains MatchList
if Var not contains MatchList
You have written:

Code: Select all

if !(gg contains Вход or Добро)

Code: Select all

if gg != ууу1,contains еее
It seems that you've just made up your own syntax. That won't work.

The first is if (expression).
An if-statement that contains an expression is differentiated from a traditional-if such as If FoundColor <> Blue by making the character after the word "if" an open-parenthesis. [...] the open-parenthesis may be omitted entirely if the first item after the word "if" is a function call or an operator such as "not" or "!".
Source: if (expression)
The second is IfNotEqual.
IfNotEqual, var, value (same: if var <> value) (!= can be used in place of <>)
Source: If/IfEqual/IfNotEqual/IfLess/IfLessOrEqual/IfGreater/IfGreaterOrEqual
Your variable gg does not contain the literal value "yyy1,contains eee", so the MsgBox is shown.

Re: Variables

Posted: 01 Jan 2017, 20:06
by guest3456
also you are assigning the variable incorrectly

Code: Select all

gg:=Добро    ; wrong

; either :
gg := "Добро"
; or
gg = Добро
read the variables help page