WinLIRC Ŭ¶óÀ̾ðÆ®

ÀÌ ½ºÅ©¸³Æ®´Â ¸®¸ðÆ® ÄÜÆ®·Ñ¿¡ ¹öÆ°À» ´©¸¦ ¶§¸¶´Ù WinLIRC ·ÎºÎÅÍ °íÁö¸¦ ¹Þ½À´Ï´Ù. Winamp, Windows Media Player, µîµîÀ» ÀÚµ¿È­ ÇÏ´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ½±°Ô ȯ°æÀ» ±¸¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î WinLIRC°¡ ¸®¸ðÆ® ÄÜÆ®·Ñ¿¡¼­ À̸§ÀÌ "VolUp"ÀÎ ¹öÆ°À» ÀÎÁöÇϸé, À̸§ÀÌ VolUpÀÎ ¶óº§À» »ý¼ºÇÏ°í ±× ¾Æ·¡¿¡ ¸í·É¾î SoundSet +5¸¦ »ç¿ëÇÏ¿© »ç¿îµåÄ«µåÀÇ º¼·ýÀ» 5%¸¸Å­ ³ôÀÔ´Ï´Ù.

ÀÌ ½ºÅ©¸³Æ® ³»·Á¹Þ±â  |  ´Ù¸¥ »ùÇà ½ºÅ©¸³Æ®  |  È¨À¸·Î

; ´ÙÀ½Àº ÀÌ ½ºÅ©¸³Æ®¸¦ »ç¿ëÇÏ´Â ¹æ¹ýÀÔ´Ï´Ù:
; 1) ¸®¸ðÆ® ÄÜÆ®·Ñ°ú ¹öÆ°À» ÀνÄÇϵµ·Ï WinLIRC¸¦ ±¸¼ºÇÕ´Ï´Ù.
;    WinLIRC´Â ´ÙÀ½¿¡ ÀÖ½À´Ï´Ù: http://winlirc.sourceforge.net
; 2) ¾Æ·¡ÀÇ CONFIG ¼½¼Ç¿¡¼­ WinLIRC °æ·Î, ÁÖ¼Ò, ±×¸®°í Æ÷Æ® ¹øÈ£¸¦ ÆíÁýÇÕ´Ï´Ù.
; 3) ÀÌ ½ºÅ©¸³Æ®¸¦ ±âµ¿½Ãŵ´Ï´Ù. ÇÊ¿äÇϸé WinLIRC ¼­¹ö°¡ ÀÚµ¿À¸·Î ±âµ¿µË´Ï´Ù.
; 4) ¸®¸ðÆ® ÄÜÆ®·Ñ¿¡¼­ ¹öÆ°À» ´­·¯ º¾´Ï´Ù. ¹öÆ°À» ´©¸¦ ¶§¸¶´Ù 
;    ÀÛÀº âÀÌ ³ªÅ¸³ª ±× ¹öÆ°ÀÇ À̸§À» º¸¿©ÁÝ´Ï´Ù.
; 5) ¹öÆ°À» ±¸¼ºÇØ Winamp, Media Player, µîµî°ú °°Àº â¿¡
;     Å°´­¸²°ú ¸¶¿ì½º Ŭ¸¯À» Àü¼ÛÇÕ´Ï´Ù. ¾Æ·¡ ¿¹Á¦¸¦ ÂüÁ¶ÇϽʽÿÀ.

; ÀÌ ½ºÅ©¸³Æ®´Â AutoHotkey 1.0.38.04 ÀÌ»óÀ» ¿ä±¸ÇÕ´Ï´Ù.
; º¯°æ ÀÌ·Â
; March 2, 2007:
; - ReceiveData()¿¡ "Critical"¸¦ ÅëÇÏ¿© ½Å·Ú¼º °³¼±.
; October 5, 2005:
; - ½Ã½ºÅÛÀÌ ¼Ë´Ù¿î/·Î±×¿ÀÇÁÇÒ ¶§ Winsock °æ°í ´ëÈ­»óÀÚ "10054"°¡ ³ªÅ¸³ª´Â °ÍÀ» Á¦°Å.
; - ¹Ýº¹ ¼Óµµ¸¦ °¨¼Ò½ÃÅ°±â À§ÇØ ¿É¼Ç "DelayBetweenButtonRepeats"¸¦ Ãß°¡.

; -------------------------------------------------------------
; CONFIGURATION SECTION: ¿©±â¿¡ ¿øÇÏ´Â ´ë·Î ¼³Á¤ÇÕ´Ï´Ù.
; -------------------------------------------------------------
; ¾î¶² ¸®¸ðÄÜÀº ¹öÆ°À» ´©¸£°í ÀÖ´Â µ¿¾È ½ÅÈ£¸¦ ºü¸£°Ô ¹Ýº¹ÇØ º¸³À´Ï´Ù.
; ÀÌ ¶§¹®¿¡ ¸®¸ðÆ® ÄÜÆ®·ÑÀÌ ¿ÀÁ÷ ÇϳªÀÇ ½ÅÈ£¸¸ Àü¼ÛÇϵµ·Ï ¸¸µé±â°¡ ¾î·Æ½À´Ï´Ù
; ´ÙÀ½ ¼³Á¤Àº  ÁöÁ¤µÈ ½Ã°£ÀÌ °æ°úÇÒ ¶§±îÁö ¹Ýº¹µÈ ½ÅÈ£¸¦ ¹«½ÃÇÔÀ¸·Î½á
; ÀÌ ¹®Á¦¸¦ ÇØ°áÇÕ´Ï´Ù. 200ÀÌ¸é º¸Åë ÁÁÀº ¼³Á¤ÀÔ´Ï´Ù.
; 0À¸·Î ¼³Á¤Çϸé ÀÌ Æ¯Â¡À» ºÒ´ÉÀ¸·Î ¸¸µì´Ï´Ù.
DelayBetweenButtonRepeats = 200

; °æ·Î¸¦ WinLIRC¿¡ ÁöÁ¤ÇÕ´Ï´Ù. ¿¹¸¦ µé¾î C:\WinLIRC\winlirc.exe
WinLIRC_Path = %A_ProgramFiles%\WinLIRC\winlirc.exe

; WinLIRCÀÇ ÁÖ¼Ò¿Í Æ÷Æ®¸¦ ÁöÁ¤ÇÕ´Ï´Ù. º¸Åë 127.0.0.1 (localhost)°ú 8765ÀÔ´Ï´Ù.
WinLIRC_Address = 127.0.0.1
WinLIRC_Port = 8765

; ´ÙÀ½ µÎ ÁÙÀº º¯°æÇÏÁö ¸¶½Ê½Ã¿À. °Ç³Ê¶Ù°í ¾Æ·¡¿¡¼­ °è¼ÓÇϽʽÿÀ.
Gosub WinLIRC_Init
return

; --------------------------------------------
; ASSIGN ACTIONS TO THE BUTTONS ON YOUR REMOTE
; --------------------------------------------
; ¾Æ·¡¿¡¼­ ¸®¸ðÆ® ÄÜÆ®·Ñ ¹öÆ°À» ±¸¼ºÇϽʽÿÀ. ¹öÆ°¿¡ WinLIRCÀÇ À̸§À» »ç¿ëÇÕ´Ï´Ù.
; À̸§Àº WinLIRC ȯ°æ±¸¼º ÆÄÀÏ(.cf)¿¡¼­ º¸½Ç ¼ö ÀÖ½À´Ï´Ù.
;  -- ¾Æ´Ï¸é ¸®¸ðÆ® ÄÜÆ®·Ñ¿¡ ¹öÆ°À» ¸¶¿ì°Í³ª ´©¸£¸é
; ½ºÅ©¸³Æ®°¡ ÀÛÀº â¿¡ ±× ¹öÆ°ÀÇ À̸§À» Àá½Ã º¸¿©ÁÝ´Ï´Ù.
; 
; ¾Æ·¡´Â ¸î °¡Áö ¿¹Á¦ÀÔ´Ï´Ù.
;  ÀÚÀ¯·Ó°Ô ¿©·¯ºÐÀÇ ±âÈ£¿¡ ¸Â°Ô °³Á¶Çϰųª Áö¿øµµ µË´Ï´Ù.

VolUp:
SoundSet +5  ; ¸¶½ºÅÍ º¼·ýÀ» 5%¸¸Å­ ´Ã¸³´Ï´Ù. Vista¿¡¼­´Â ÀÌ ÁÙÀ» ´ÙÀ½À¸·Î ±³Ã¼ÇϽʽÿÀ: Send {Volume_Up}
return

VolDown:
SoundSet -5  ; ¸¶½ºÅÍ º¼·ýÀ» 5%¸¸Å­ ÁÙÀÔ´Ï´Ù. Vista¿¡¼­´Â ÀÌ ÁÙÀ» ´ÙÀ½À¸·Î ±³Ã¼ÇϽʽÿÀ: Send {Volume_Down}
return

ChUp:
WinGetClass, ActiveClass, A
if ActiveClass in Winamp v1.x,Winamp PE  ; Winamp°¡ È°¼ºÈ­ µÇ¾î ÀÖ½À´Ï´Ù.
    Send {right}  ; ¿À¸¥ÂÊ-È­»ìÇ¥ Å°´­¸²À» Àü¼ÛÇÕ´Ï´Ù.
else  ; ´Ù¸¥ À¯ÇüÀÇ Ã¢ÀÌ È°¼ºÈ­ µÇ¾î ÀÖ½À´Ï´Ù.
    Send {WheelUp}  ; ¸¶¿ì½º ÈÙÀ» ÇÑ ´«±Ý À§·Î µ¹¸³´Ï´Ù.
return

ChDown:
WinGetClass, ActiveClass, A
if ActiveClass in Winamp v1.x,Winamp PE  ; Winamp°¡ È°¼ºÈ­ µÇ¾î ÀÖ½À´Ï´Ù.
    Send {left}  ; ¿ÞÂÊ-È­»ìÇ¥ Å°´­¸²À» Àü¼ÛÇÕ´Ï´Ù.
else  ; ´Ù¸¥ À¯ÇüÀÇ Ã¢ÀÌ È°¼ºÈ­ µÇ¾î ÀÖ½À´Ï´Ù.
    Send {WheelDown}  ; ¸¶¿ì½º ÈÙÀ» ÇÑ ´«±Ý ¾Æ·¡·Î µ¹¸³´Ï´Ù.
return

Menu:
IfWinExist, Untitled - Notepad
{
    WinActivate
}
else
{
    Run, Notepad
    WinWait, Untitled - Notepad
    WinActivate
}
Send Here are some keystrokes sent to Notepad.{Enter}
return

; À§ÀÇ ¿¹Á¦¿¡¼­ ¾î¶»°Ô ÀϹÝÀûÀÎ °ú¾÷À» ´Þ¼ºÇÏ´ÂÁö °¨À» ÀâÀ» ¼ö ÀÖ½À´Ï´Ù.
; ¿ÀÅäÇÖÅ°ÀÇ ±âº» Áö½ÄÀ» ½ÀµæÇÏ·Á¸é »¡Áö ½ÃÀÛÇϱâ ÀÚ½À¼­¸¦ ã¾Æ º¸½Ã±â ¹Ù¶ø´Ï´Ù:
; http://www.autohotkey.com/docs/Tutorial.htm

; ----------------------------
; END OF CONFIGURATION SECTION
; ----------------------------
; ÀÌ ½ÃÁ¡ ÀÌÈÄ·Î º¯°æÇÏÁö ¸¶½Ê½Ã¿À.
; ´Ü, ½ºÅ©¸³Æ®ÀÇ ÇÙ½É ±â´ÉÀ» ¹Ù²Ù°í ½Í´Ù¸é ¿¹¿ÜÀÔ´Ï´Ù.

WinLIRC_Init:
OnExit, ExitSub  ; Á¢¼Ó û¼Ò ¸ñÀûÀ» À§ÇØ.

; ¾ÆÁ÷ ½ÇÇàµÇÁö ¾Ê¾Ò´Ù¸é WinLIRC¸¦ ±âµ¿ÇÕ´Ï´Ù:
Process, Exist, winlirc.exe
if not ErrorLevel  ; WinLIRC¿¡ ´ëÇÑ PID°¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù.
{
    IfNotExist, %WinLIRC_Path%
    {
        MsgBox ÆÄÀÏ "%WinLIRC_Path%"°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù. ÀÌ ½ºÅ©¸³Æ®¸¦ ÆíÁýÇØ ±× À§Ä¡¸¦ ÁöÁ¤ÇϽʽÿÀ.
        ExitApp
    }
    Run %WinLIRC_Path%
    Sleep 200  ; WinLIRC¿¡ ÃʱâÈ­ ÇÒ ½Ã°£À» ÁÝ´Ï´Ù (¾Æ¸¶µµ °ÅÀÇ ÇÊ¿äÇÏÁö ¾ÊÀ» °Ì´Ï´Ù. ½Å°æ¾²Áö ¸¶½Ê½Ã¿À).
}

; WinLIRC¿¡ Á¢¼ÓÇÕ´Ï´Ù (¶Ç´Â ±×¸¦ ´ë½ÅÇÏ¸é ¾î¶² Á¾·ùÀÇ ¼­¹öÀ̵ç Á¢¼ÓÇÕ´Ï´Ù):
socket := ConnectToAddress(WinLIRC_Address, WinLIRC_Port)
if socket = -1  ; Á¢¼Ó ½ÇÆÐ (ÀÌ¹Ì ÀÌÀ¯´Â º¸¿©ÁÖ¾ú½À´Ï´Ù).
    ExitApp

; ÀÌ ½ºÅ©¸³Æ®ÀÇ ¸ÞÀΠâÀ» ã½À´Ï´Ù:
Process, Exist  ; ÀÌ·¸°Ô Çϸé ErrorLevel¿¡ ÀÌ ½ºÅ©¸³Æ®ÀÇ PID°¡ ¼³Á¤µË´Ï´Ù (ÀÌ·±½ÄÀ¸·Î Çϸé ÄÄÆÄÀÏµÈ ½ºÅ©¸³Æ®¸¦ Áö¿øÇÒ ¼ö ÀÖ½À´Ï´Ù).
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off

; OS°¡ ½ºÅ©¸³Æ®¿¡°Ô µé¾î¿À´Â µ¥ÀÌÅÍ°¡ ¼ö½ÅµÇ±â¸¦ ±â´Ù¸®°í ÀÖ´Ù°í °íÁöÇÒ ¶§,
; ´ÙÀ½Àº ±× µ¥ÀÌÅ͸¦ Àбâ À§ÇÏ¿© ÇÔ¼ö¸¦ ±âµ¿½Ãŵ´Ï´Ù:
NotificationMsg = 0x5555  ; ÀÓÀÇÀÇ ¸Þ½ÃÁö ¹øÈ£, ±×·¯³ª 0x1000 º¸´Ù´Â Ä¿¾ß ÇÕ´Ï´Ù.
OnMessage(NotificationMsg, "ReceiveData")

; Á¢¼ÓÀ» ¼³Á¤ÇØ ÀÌ ½ºÅ©¸³Æ®¿¡°Ô »õ·Î µ¥ÀÌÅÍ°¡ µµÂøÇÒ ¶§¸¶´Ù ¸Þ½ÃÁö¸¦ ÅëÇÏ¿© °íÁöÇÕ´Ï´Ù.
; ÀÌ·¸°Ô Çϸé Á¢¼ÓÀ» ÆúÇÒ ÇÊ¿ä°¡ ¾øÀ¸¹Ç·Î, ÀÚ¿ø ³¶ºñ°¡ °¨¼ÒÇÕ´Ï´Ù.
FD_READ = 1     ; µ¥ÀÌÅ͸¦ ÀÐÀ» ¼ö ÀÖÀ» ¶§ ¼ö½ÅµË´Ï´Ù.
FD_CLOSE = 32   ; Á¢¼ÓÀÌ ´ÝÈú ¶§ ¼ö½ÅµË´Ï´Ù.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE)
{
    MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
    ExitApp
}
return



ConnectToAddress(IPAddress, Port)
; ´ëºÎºÐÀÇ À¯ÇüÀÇ TCP ¼­¹ö¿¡ Á¢¼ÓÇÒ ¼ö ÀÖ½À´Ï´Ù. WinLIRC ¸¸À¸·Î Á¦ÇѵÇÁö ¾Ê½À´Ï´Ù.
; ½ÇÆÐÇϸé -1 (INVALID_SOCKET)À» µ¹·ÁÁÖ°í ¼º°øÇÏ¸é ¼ÒÄÏ ID¸¦ µ¹·ÁÁÝ´Ï´Ù.
{
    VarSetCapacity(wsaData, 400)
    result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Winsock 2.0 (0x0002)À» ¿ä±¸ÇÕ´Ï´Ù
    ; WSAStartup()ÀÌ À̽ºÅ©¸³Æ®°¡ ù ¹ø°·Î È£ÃâÇÑ Winsock ÇÔ¼öÀÏ °¡´É¼ºÀÌ ³ôÀ¸¹Ç·Î,
    ; ErrorLevelÀ» Á¡°ËÇØ OS¿¡ Winsock 2.0ÀÌ ÀÖ´ÂÁö ¾Ë¾Æ º¾´Ï´Ù:
    if ErrorLevel
    {
        MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
        return -1
    }
    if result  ; 0ÀÌ ¾Æ´Ï¶ó¸é, ½ÇÆÐÇß´Ù´Â ¶æÀÔ´Ï´Ù (´ëºÎºÐÀÇ Winsock ÇÔ¼ö´Â ¼º°øÇϸé 0À» µ¹·ÁÁÝ´Ï´Ù).
    {
        MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
        return -1
    }

    AF_INET = 2
    SOCK_STREAM = 1
    IPPROTO_TCP = 6
    socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
    if socket = -1
    {
        MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
        return -1
    }

    ; Á¢¼ÓÀ» ÁغñÇÕ´Ï´Ù:
    SizeOfSocketAddress = 16
    VarSetCapacity(SocketAddress, SizeOfSocketAddress)
    InsertInteger(2, SocketAddress, 0, AF_INET)   ; sin_family
    InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2)   ; sin_port
    InsertInteger(DllCall("Ws2_32\inet_addr", "AStr", IPAddress), SocketAddress, 4, 4)   ; sin_addr.s_addr

    ; Á¢¼ÓÀ» ½ÃµµÇÕ´Ï´Ù:
    if DllCall("Ws2_32\connect", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
    {
        MsgBox % "connect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . ". Is WinLIRC running?"
        return -1
    }
    return socket  ; -1 ¸»°í À¯È¿ÇÑ ¼ÒÄÏ ID¸¦ µ¹·ÁÁÖ¾î ¼º°øÀ» ¾Ë¸³´Ï´Ù.
}



ReceiveData(wParam, lParam)
; OnMessage()¸¦ ¼ö´ÜÀ¸·Î, ÀÌ ÇÔ¼ö´Â »õ µ¥ÀÌÅÍ°¡ Á¢¼Ó¿¡ µµÂøÇÒ ¶§¸¶´Ù
; ÀÚµ¿À¸·Î È£ÃâµÇµµ·Ï ¼³Á¤µÇ¾î ÀÖ½À´Ï´Ù. µ¥ÀÌÅ͸¦ WinLIRC·ÎºÎÅÍ Àо
; ±× ³»¿ë¿¡ µû¶ó ÀûÀýÇÏ°Ô Á¶Ä¡¸¦ ÃëÇÕ´Ï´Ù.
{
    Critical  ; ÀÌ¹Ì ¾²·¹µå°¡ ½ÇÇàµÇ¾î Àֱ⠶§¹®¿¡ ¶Ç´Ù¸¥ °°Àº ¸Þ½ÃÁö°¡ Æó±âµÇÁö ¾Êµµ·Ï ¸·½À´Ï´Ù.
    socket := wParam
    ReceivedDataSize = 4096  ; ÀÌÀü µ¥ÀÌÅ͸¦ ó¸®Çϴµ¥ Áö¿¬ ½Ã°£ÀÌ À־ ¸¹Àº µ¥ÀÌÅÍ°¡ ¹öÆÛ¿¡ Âû °æ¿ì¸¦ ´ëºñÇØ Å©°Ô Àâ½À´Ï´Ù.

    VarSetCapacity(ReceivedData, ReceivedDataSize, 0)  ; recv()¿¡ »ç¿ëÇϱâ À§ÇØ 0À» ¸¶Áö¸· ¸Å°³º¯¼ö¿¡ ÁöÁ¤ÇØ ¹®ÀÚ¿­À» Á¾·áÇÕ´Ï´Ù.
    ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
    if ReceivedDataLength = 0  ; Á¢¼ÓÀÌ ¿ì¾ÆÇÏ°Ô ´ÝÇû½À´Ï´Ù. ¾Æ¸¶µµ WinLIRC¸¦ ³¡³Â±â ¶§¹®ÀÏ °ÍÀÔ´Ï´Ù.
        ExitApp  ; OnExit ·çƾÀÌ ¿ì¸®¸¦ ´ë½ÅÇÏ¿© WSACleanup()À» È£ÃâÇØ ÁÝ´Ï´Ù.
    if ReceivedDataLength = -1
    {
        WinsockError := DllCall("Ws2_32\WSAGetLastError")
        if WinsockError = 10035  ; WSAEWOULDBLOCK, "´õ ÀÌ»ó ÀÐÀ» µ¥ÀÌÅÍ°¡ ¾ø´Ù"´Â ¶æÀÔ´Ï´Ù.
            return 1
        if WinsockError <> 10054 ; WSAECONNRESET, WinLIRC°¡ ½Ã½ºÅÛ ¼Ë´Ù¿î/·Î±×¿ÀÇÁ¸¦ ÅëÇÏ¿© ´ÝÈú ¶§ ÀϾ´Ï´Ù.
            ; ¿¹Ãø ÇÏÁö ¸øÇÑ ¿¡·¯À̹ǷΠº¸°íÇÕ´Ï´Ù.  ¶Ç ¹«ÇÑ È¸µ¹À̸¦ ÇÇÇϱâ À§ÇØ Á¾·áÇÕ´Ï´Ù.
            MsgBox % "recv() indicated Winsock error " . WinsockError
        ExitApp  ; OnExit ·çƾÀÌ ¿ì¸®¸¦ ´ë½Å¿¡ WSACleanup()¸¦ È£ÃâÇÕ´Ï´Ù.
    }
    ; ±×·¸Áö ¾ÊÀ¸¸é, ¼ö½ÅµÈ µ¥ÀÌÅ͸¦ ó¸®ÇÕ´Ï´Ù. Å×½ºÆ®¿¡ ÀÇÇϸé ÇÑ ¹ø¿¡ ÇÑ ÁÙ ÀÌ»óÀ» ¾òÀ» ¼ö ÀÖ½À´Ï´Ù
    ; (¸í½ÃÀûÀ¸·Î-Àü¼ÛµÈ IR ½ÅÈ£¿¡ ´ëÇؼ­µµ ¸¶Âù°¡ÁöÀÔ´Ï´Ù), ´ÙÀ½ ¸Þ½îµå°¡ ÀûÀýÇÏ°Ô Ã³¸®ÇÕ´Ï´Ù.
    ; WinLIRC·ÎºÎÅÍ ¾òÀº µ¥ÀÌÅÍ´Â ´ÙÀ½ ¿¹Á¦¿Í ºñ½ÁÇÕ´Ï´Ù (ÀÚ¼¼ÇÑ °ÍÀº WinLIRC ¹®¼­¸¦ ÂüÁ¶ÇϽʽÿÀ):
    ; 0000000000eab154 00 NameOfButton NameOfRemote
    Loop, parse, ReceivedData, `n, `r
    {
        if A_LoopField in ,BEGIN,SIGHUP,END  ; ºó ÁÙ°ú WinLIRCÀÇ ½ÃÀÛ ¸Þ½ÃÁö¸¦ ¹«½ÃÇÕ´Ï´Ù.
            continue
        ButtonName =  ; ¾Æ·¡¿¡¼­ 3 °³ º¸´Ù Àû°Ô Çʵ尡 ¹ß°ßµÉ °æ¿ì¸¦ ´ëºñÇØ ºñ¿ö¼­ ÃʱâÈ­ÇÕ´Ï´Ù.
        Loop, parse, A_LoopField, %A_Space%  ; ¹öÆ° À̸§À» ÃßÃâÇÕ´Ï´Ù. ¼¼ ¹ø° ÇʵåÀÔ´Ï´Ù.
            if A_Index = 3
                ButtonName := A_LoopField
        global DelayBetweenButtonRepeats  ; Àü¿ª º¯¼ö¸¦ ¼±¾ðÇØ ÀÌ ÇÔ¼ö¿¡ Àû¿ëÇÕ´Ï´Ù.
        static PrevButtonName, PrevButtonTime, RepeatCount  ; ÀÌ º¯¼öµéÀº È£Ãâ »çÀÌ¿¡ °ªÀ» ±â¾ïÇÕ´Ï´Ù.
        if (ButtonName != PrevButtonName || A_TickCount - PrevButtonTime > DelayBetweenButtonRepeats)
        {
            if IsLabel(ButtonName)  ; ÀÌ ¹öÆ°¿¡ ¿¬°üµÈ ¼­ºê·çƾÀÌ ÀÖ½À´Ï´Ù.
                Gosub %ButtonName%  ; ±× ¼­ºê·çƾÀ» ±âµ¿½Ãŵ´Ï´Ù.
            else ; ¿¬°üµÈ ¼­ºê·çƾÀÌ ¾øÀ¸¹Ç·Î, °£·«ÇÏ°Ô ¾î´À ¹öÆ°ÀÌ ´­·È´ÂÁö º¸¿©ÁÝ´Ï´Ù.
            {
                if (ButtonName == PrevButtonName)
                    RepeatCount += 1
                else
                    RepeatCount = 1
                SplashTextOn, 150, 20, Button from WinLIRC, %ButtonName% (%RepeatCount%)
                SetTimer, SplashOff, 3000  ; ÀÌ·¸°Ô Çϸé âÀÌ º¸ÀÌ´Â µ¿¾È¿¡ ´õ ¸¹Àº ½ÅÈ£¸¦ ó¸®ÇÒ ¼ö ÀÖ½À´Ï´Ù.
            }
            PrevButtonName := ButtonName
            PrevButtonTime := A_TickCount
        }
    }
    return 1  ; ÇÁ·Î±×·¥¿¡°Ô ´õ ÀÌ»ó ÀÌ ¸Þ½ÃÁö¸¦ ó¸®ÇÒ ÇÊ¿ä°¡ ¾ø´Ù°í ¾Ë¸³´Ï´Ù.
}



SplashOff:
SplashTextOff
SetTimer, SplashOff, Off
return



InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
; È£ÃâÀÚ´Â pDestÀÇ °¡¿ë ´É·ÂÀÌ ÃæºÐÇÑÁö È®ÀÎÇØ¾ß ÇÕ´Ï´Ù. ±âÁ¸ÀÇ ³»¿ëÀ» pDest¿¡ º¸Á¸Çϱâ À§ÇØ,
; pOffset¿¡¼­ ½ÃÀÛÇؼ­ ¿ÀÁ÷ pSize °³¼öÀÇ ¹ÙÀÌÆ®¸¸ º¯°æµË´Ï´Ù.
{
    Loop %pSize%  ; °¢ ¹ÙÀÌÆ®¸¦ ±¸Á¶Ã¼ ¾ÈÀ¸·Î ³¯ ÀÌÁø µ¥ÀÌÅÍ·Î º¹»çÇÕ´Ï´Ù.
        DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}



ExitSub:  ; ÀÌ ¼­ºê·çƾÀº ½ºÅ©¸³Æ®°¡ ¾î¶² ÀÌÀ¯·Î Á¾·áµÉ ¶§ ÀÚµ¿À¸·Î È£ÃâµË´Ï´Ù.
; MSDN¿¡ ÀÇÇϸé: "WSACleanupÀÌ È£ÃâµÉ ¶§ ¿­¸° ¼ÒÄÏÀº ¸ðµÎ ¸®¼ÂµÇ°í 
; ¸¶Ä¡ closesocket ÀÌ È£ÃâµÉ °Íó·³ ÀÚµ¿À¸·Î ÇÒ´çÀÌ ÇØÁ¦µË´Ï´Ù."
DllCall("Ws2_32\WSACleanup")
ExitApp