Weneedu 2020. 3. 25. 21:43

20200325 2247 

 

00 헷갈린다. 예시를 모아보자.

 

★★ 도움말에서 "Scripting Language"를 읽어보자!!!!!!!!!!!!!!!!

source = 도움말 > Variables and Expressions

 

01 변수에 값을 넣는 방법 2 가지 ⇒ this makes Ambiguouty

 

1/ legacy method

MyNumber = 123

MyString = This is a literal string.

 

2/ expression method

MyNumber := 123

MyString := "This is a literal string."

 

02 변수의 내용물 추출 방법 2 가지 ⇒ this makes Ambiguouty

 

1/ legacy method

CopyOfVar = %Var%

 

2/ expression method

CopyOfVar := Var

 

★ Expression인데 %%로 변수를 감싸는 경우; 위 1/과 2/가 짬뽕인데.???

If a variable is enclosed in percent signs within an expression (e.g. %Var%), whatever that variable contains is assumed to be the name or partial name of another variable (if there is no such variable, %Var% resolves to a blank string). 만약 변수가 %로 감싸져있고 Expression안에 있다면, 변수가 무엇을 담고 있든간에 다른 변수의 이름으로 간주된다. 만약 그런 변수가 없다면 %Var%는 공백문자로 인식된다.

 

 

03 MsgBox

 

1/ legacy

MsgBox The value in the variable named Var is %Var%.

 

2/ expression

MsgBox % "The value in the variable named Var is " . Var . "." ; A period is used to concatenate (join) two strings.

 

★ Command에는 legay method쓴다(MsgBox를 보라)

 

04 If statement

if (MyVar != "") ; would be true if MyVar is not blank

if MyVar = "" ; is true only if MyVar contains an actual pair of quotes

if MyVar = ;to check if a variable is blank with a traditional-if, use = or != with nothing on the right side

 

05 Force an expression ⇒ "% + 공백"

1/ by preceding the expression with a percent sign and a space or tab ⇒ An expression can be used in a parameter 

FileAppend, % MyArray[i], My File.txt
FileAppend, % MyPseudoArray%i%, My File.txt
MsgBox % "The variable MyVar contains " . MyVar . "."
Loop % Iterations + 1
WinSet, Transparent, % X + 100
Control, Choose, % CurrentSelection - 1

 

06 쉼표 Comma

Comma (multi-statement) [v1.0.46+]. Commas may be used to write multiple sub-expressions on a single line. This is most commonly used to group together multiple assignments or function calls. For example: x:=1, y+=2, ++index, MyFunc(). Such statements are executed in order from left to right.

Note: A line that begins with a comma (or any other operator) is automatically appended to the line above it. See also: comma performance.