If/IfEqual/IfNotEqual/IfLess/IfLessOrEqual/IfGreater/IfGreaterOrEqual

º¯¼ö¸¦ º¯¼öÇØ ºñ±³ÇØ TRUE·Î Æò°¡µÉ °æ¿ì ¼öÇàÇÒ ¸í·É¾î(µé)À» ÁöÁ¤ÇÕ´Ï´Ù. ¸í·É¾î°¡ ¿©·µ Á¸ÀçÇϸé, ºí·Ï (È°°ýÈ£) ¾È¿¡ µÑ·¯ ½Î½Ê½Ã¿À.

IfEqual, var, value (same: if var = value)
IfNotEqual, var, value (same: if var <> value) (!= can be used in place of <>)
IfGreater, var, value (same: if var > value)
IfGreaterOrEqual, var, value (same: if var >= value)
IfLess, var, value (same: if var < value)
IfLessOrEqual, var, value (same: if var <= value)
If var ; º¯¼öÀÇ ³»¿ëÀÌ ºñ¾î Àְųª 0À̸é, °ÅÁþÀ¸·Î °£Áֵ˴ϴÙ. ±×·¸Áö ¾ÊÀ¸¸é ÂüÀÔ´Ï´Ù.

´ÙÀ½µµ ÂüÁ¶: IfInString

¸Å°³º¯¼ö

var

º¯¼ö À̸§.

value

±âÈ£ ¹®ÀÚ¿­, ¼ýÀÚ ¶Ç´Â º¯¼ö ÂüÁ¶ (¿¹, %var2%). var¸¦ ºó ¹®ÀÚ¿­¿¡ ºñ±³ÇÏ°í ½Í´Ù¸é °ªÀ» »ý·«ÇÒ ¼ö ÀÖ½À´Ï´Ù.

³íÆò

º¯¼ö(var)¿Í °ª(value)ÀÌ ¼ø¼öÇÏ°Ô ¼ýÄ¡¶ó¸é, ¹®ÀÚ¿­ÀÌ ¾Æ´Ï¶ó ¼ýÀÚ·Î ºñ±³µË´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é, ¹®ÀÚ¿­·Î ¾ËÆĺª ¼øÀ¸·Î ºñ±³µË´Ï´Ù (Áï, ¾ËÆĺª ¼ý¼­·Î var°¡ valueº¸´Ù Å«Áö ÀÛÀºÁö °°ÀºÁö °áÁ¤ÇÕ´Ï´Ù).

IF ¶Ç´Â ELSE°¡ ¿©·¯ ÁÙÀ» ¼ÒÀ¯Çϸé, ±×·± ÁÙµéÀº È°°ýÈ£·Î µÑ·¯ ½Î¾ß ÇÕ´Ï´Ù. ¿¹¸¦ µé¾î:

if count <= 0
{
    WinClose Untitled - Notepad
    MsgBox ¾î¶² Ç׸ñµµ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.
}

±×·¸Áö¸¸, ÇÑ ÁÙ¸¸ IF ¶Ç´Â ELSE¿¡ ¼ÓÇÑ´Ù¸é, È°°ýÈ£´Â ¼±ÅÃÀûÀÔ´Ï´Ù.

¸í·É¾î-À̸§ ½ºÅ¸ÀÏÀ» »ç¿ëÇÑ´Ù¸é, ¶Ç´Ù¸¥ ¸í·É¾î´Â IF ¼­¼ú¹®°ú °°Àº ÁÙ¿¡¸¸ ³ªÅ¸³¯ ¼ö ÀÖ½À´Ï´Ù. ´Ù¸¥ ¸»·Î, ´ÙÀ½Àº À¯È¿ÇÕ´Ï´Ù:

IfEqual, x, 1, Sleep, 1
IfGreater, x, 1, EnvAdd, x, 2

±×·¯³ª ´ÙÀ½Àº À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù:

if x = 1 Sleep 1
IfGreater, x, 1, x += 2

One True Brace (OTB) ½ºÅ¸ÀÏÀº ÀÌ·± À¯ÇüÀÌ if ¼­¼ú¹®¿¡ »ç¿ëÇÏ¸é ¾È µË´Ï´Ù. ¿ÀÁ÷ Ç¥Çö½Ä if-¼­¼ú¹®¿¡¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.

°ü·ÃÇÏ¿© ¸»¾¸µå¸®ÀÚ¸é, ´ÙÀ½ ¸í·É¾î if var [not] between LowerBound and UpperBound´Â º¯¼ö°¡ µÎ °ª »çÀÌ¿¡ ÀÖ´ÂÁö Á¡°ËÇÕ´Ï´Ù. ±×¸®°í if var [not] in value1,value2´Â º¯¼öÀÇ ³»¿ëÀÌ °ª ¸ñ·Ï ¾È¿¡ Á¸ÀçÇÏ´ÂÁö Á¡°ËÇÏ´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.

°ü·Ã Ç׸ñ

IF (expression), StringCaseSense, ÇÒ´ç Ç¥Çö½Ä (:=), if var in/contains MatchList, if var between, IfInString, ºí·Ï, Else

¿¹Á¦

if counter >= 1
    Sleep, 10

if counter >=1   ; ¸¸¾à IF¿¡ ¿©·¯ ÁÙÀÌ ÀÖ´Ù¸é, ±× ÁÙµéÀº È°°ýÈ£ ¾È¿¡ ½Î ³ÖÀ¸½Ê½Ã¿À:
{
    WinClose, Untitled - Notepad
    Sleep 10
}

if MyVar = %MyVar2%
    MsgBox MyVar¿Í MyVar2ÀÇ ³»¿ëÀº µ¿ÀÏÇÕ´Ï´Ù.
else if MyVar =
{
    MsgBox, 4,, MyVar°¡ ºñ¾î ÀÖ½À´Ï´Ù. °è¼ÓÇϽðڽÀ´Ï±î?
    IfMsgBox, No
        Return
}
else if MyVar <> ,
    MsgBox MyVarÀÇ °ªÀº ½°Ç¥°¡ ¾Æ´Õ´Ï´Ù.
else
    MsgBox MyVarÀÇ °ªÀº ½°Ç¥ÀÔ´Ï´Ù.

if Done
    MsgBox º¯¼ö DoneÀº ºñ¾î ÀÖÁöµµ ¾Ê°í 0µµ ¾Æ´Õ´Ï´Ù.