IntelliSense -- by Rajat (XP/2k/NT ÀÌ»ó)

ÀÌ ½ºÅ©¸³Æ®´Â AutoHotkey ½ºÅ©¸³Æ®¸¦ ÆíÁýÇÏ´Â µ¿¾È °¨½ÃÇÏ´Ù°¡ ¸í·É¾î ´ÙÀ½¿¡ ½°Ç¥³ª ½ºÆäÀ̽º¸¦ ŸÀÚÇÏ´Â ¼ø°£, ±× ¸í·É¾îÀÇ ¸Å°³º¯¼ö ¸®½ºÆ®¸¦ º¸¿©ÁÝ´Ï´Ù °Ô´Ù°¡ Ctrl+F1 (¶Ç´Â ¿©·¯ºÐÀÇ ¼±Åÿ¡ µû¶ó ´Ù¸¥ ÇÖÅ°)¸¦ ´©¸£¸é ±× ¸í·É¾îÀÇ µµ¿ò¸»À» º¸¿©ÁÝ´Ï´Ù. ¸Å°³º¯¼ö ¸®½ºÆ®¸¦ Ãë¼ÒÇÏ·Á¸é Escape ¶Ç´Â Enter¸¦ ´©¸£½Ê½Ã¿À.

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

; Requires v1.0.41+

; CONFIGURATION SECTION: ½ºÅ©¸³Æ®¸¦ ´Ù¿ò º¯¼ö·Î Àç´ÜÇÕ´Ï´Ù.

; ¾Æ·¡ÀÇ ÇÖÅ°¸¦ ´©¸£¸é ÇöÀç ¸í·É¾îÀÇ µµ¿ò¸»À» º¸¿©ÁÝ´Ï´Ù:
I_HelpHotkey = ^F1

; ¾Æ·¡ÀÇ ¹®ÀÚ¿­ÀÌ È°¼ºÃ¢ÀÇ Á¦¸ñ¿¡ Á¸ÀçÇؾß
; ŸÀÚÇÏ´Â µ¿¾È IntelliSense°¡ ÀÛµ¿ÇÕ´Ï´Ù.  ºñ¿ö µÎ¸é
; IntelliSense´Â ¸ðµç â¿¡ ÀÛµ¿ÇÕ´Ï´Ù. Pad·Î ¸¸µé¸é 
; Metapad, Notepad, ±×¸®°í Textpad °°Àº ÆíÁý±â¿¡¼­ ÀÛµ¿ÇÕ´Ï´Ù.  .ahk·Î ¸¸µé¸é
; ¿ÀÁ÷ .ahk ÆÄÀÏÀÌ Notepad, Metapad, µîµî¿¡ ¿­·Á ÀÖÀ» °æ¿ì¿¡¸¸ ÀÛµ¿ÇÕ´Ï´Ù.
I_Editor = pad

; Æ®·¹ÀÌ¿¡ ´Ù¸¥ ½ºÅ©¸³Æ®¿Í Â÷º°À» À§ÇØ ÀÌ ½ºÅ©¸³Æ®¿¡ ´ëÇÏ¿© ´Ù¸¥ ¾ÆÀÌÄÜÀ» »ç¿ëÇÏ°í ½ÍÀ¸¸é
; ¾Æ·¡¿¡ ÆÄÀÏ À̸§À» Á¦°øÇϽʽÿÀ. (ºñ¿ö µÎ¸é ¾ÆÀÌÄÜÀÌ ¾ø½À´Ï´Ù).
; ¿¹¸¦ µé¾î: E:\stuff\Pics\icons\GeoIcons\Information.ico
I_Icon = 

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

SetKeyDelay, 0
#SingleInstance

if I_HelpHotkey <>
    Hotkey, %I_HelpHotkey%, I_HelpHotkey

; Æ®·¹ÀÌ ¾ÆÀÌÄÜÀ» ¹Ù²ß´Ï´Ù (À§ÀÇ È¯°æ ±¸¼º ¼½¼Ç¿¡ ÁöÁ¤µÇ¾î ÀÖ´Ù¸é):
if I_Icon <>
    IfExist, %I_Icon%
        Menu, Tray, Icon, %I_Icon%

; ¿ÀÅäÇÖÅ°ÀÇ À§Ä¡¸¦ ¾Ë¾Æ ³À´Ï´Ù:
RegRead, ahk_dir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
if ErrorLevel  ; ¹ß°ßÀÌ ¾È µÇ¾úÀ¸¹Ç·Î, ´Ù¸¥ À§Ä¡¿¡¼­ ã¾Æ º¾´Ï´Ù.
{
    if A_AhkPath
        SplitPath, A_AhkPath,, ahk_dir
    else IfExist ..\..\AutoHotkey.chm
        ahk_dir = ..\..
    else IfExist %A_ProgramFiles%\AutoHotkey\AutoHotkey.chm
        ahk_dir = %A_ProgramFiles%\AutoHotkey
    else
    {
        MsgBox Could not find the AutoHotkey folder.
        ExitApp
    }
}

ahk_help_file = %ahk_dir%\AutoHotkey.chm

; ¸í·É¾î ±¸¹®À» ÀнÀ´Ï´Ù:
Loop, Read, %ahk_dir%\Extras\Editors\Syntax\Commands.txt
{
    I_FullCmd = %A_LoopReadLine%

    ; Áö½Ã¾îµéÀº ½°Ç¥°¡ ¾Æ´Ï¶ó ½ºÆäÀ̽º¸¦ ù ¹ø°·Î °¡Áý´Ï´Ù.
    ; ±×·¡¼­ ¸ÕÀú ¿À´Â °ÍÀ» ¸í·É¾î À̸§ÀÇ ³¡À¸·Î °£ÁÖÇÕ´Ï´Ù:
    StringGetPos, I_cPos, I_FullCmd, `,
    StringGetPos, I_sPos, I_FullCmd, %A_Space%
    if (I_cPos = -1 or (I_cPos > I_sPos and I_sPos <> -1))
        I_EndPos := I_sPos
    else
        I_EndPos := I_cPos

    if I_EndPos <> -1
        StringLeft, I_CurrCmd, I_FullCmd, %I_EndPos%
    else  ; ÀÌ Áö½Ã¾î/¸í·É¾î´Â ¸Å°³º¯¼ö°¡ ¾ø½À´Ï´Ù.
        I_CurrCmd = %A_LoopReadLine%
    
    StringReplace, I_CurrCmd, I_CurrCmd, [,, All
    StringReplace, I_CurrCmd, I_CurrCmd, %A_Space%,, All
    StringReplace, I_FullCmd, I_FullCmd, ``n, `n, All
    StringReplace, I_FullCmd, I_FullCmd, ``t, `t, All
    
    ; ¸í·É¾î À̸§ ¹è¿­°ú ¿ÏÀüÇÑ cmd ±¸¹®À» ±¸¼ºÇÕ´Ï´Ù:
    I_Cmd%A_Index% = %I_CurrCmd%
    I_FullCmd%A_Index% = %I_FullCmd%
}

; Input ¸í·É¾î¸¦ »ç¿ëÇØ »ç¿ëÀÚ°¡ ŸÀÚÇÏ´Â ¸í·É¾î¸¦ °¨½ÃÇÕ´Ï´Ù:
Loop
{
    ; ÆíÁý±â â Á¡°Ë:
    WinGetTitle, ActiveTitle, A
    IfNotInString, ActiveTitle, %I_Editor%
    {
        ToolTip
        Sleep, 500
        Continue
    }
    
    ; ¿£µåÅ°¸¦ ¸¸³¯¶§±îÁö ¸ðµç Å°¸¦ ¾ò½À´Ï´Ù:
    Input, I_Word, V, {enter}{escape}{space}`,
    I_EndKey = %ErrorLevel%
    
    ; ÀÌ °æ¿ì ÅøÆÁÀº º¸ÀÌÁö ¾Ê½À´Ï´Ù:
    if I_EndKey in EndKey:Enter,EndKey:Escape
    {
        ToolTip
        Continue
    }

    ; ´Ù½Ã ÆíÁý±â âÀ» Á¡°ËÇÕ´Ï´Ù!
    WinGetActiveTitle, ActiveTitle
    IfNotInString, ActiveTitle, %I_Editor%
    {
        ToolTip
        Continue
    }

    ; Á¸ÀçÇÏ´Â µé¿©¾²±â ¸¸Å­ º¸»óÇÕ´Ï´Ù:
    StringReplace, I_Word, I_Word, %A_Space%,, All
    StringReplace, I_Word, I_Word, %A_Tab%,, All
    if I_Word =
        Continue
    
    ; ÁÖ¼® ÁÙÀ» Á¡°ËÇÕ´Ï´Ù:
    StringLeft, I_Check, I_Word, 1
    if (I_Check = ";" or I_Word = "If")  ; "If"´Â ÅøÆÁÀ» º¸¿©Áֱ⿡´Â ³Ê¹« °ÅÃßÀ彺·´½À´Ï´Ù.
        Continue

    ; ´Ü¾î¸¦ ¸í·É¾î¿¡ ºÎÇÕ½Ãŵ´Ï´Ù:
    I_Index =
    Loop
    {
        ; µ¿Àû º¯¼ö¸¦ ÇÑ ¹ø¸¸ °áÁ¤ÇÏ¸é ¼öÇ༺´ÉÀÌ °³¼±µË´Ï´Ù.
        ; °Ô´Ù°¡,  I_ThisCmd¿¡ ¹è°æµÈ °ªÀº ¶Ç
        ; I_HelpHotkey ¼­ºê·çƾÀÌ »ç¿ëÇÕ´Ï´Ù:
        I_ThisCmd := I_Cmd%A_Index%
        if I_ThisCmd =
            break
        if (I_Word = I_ThisCmd)
        {
            I_Index := A_Index
            I_HelpOn = %I_ThisCmd%
            break
        }
    }
    
    ; ºÎÇÕÀÌ ¾øÀ¸¸é »ç¿ëÀÚ ÀÔ·Â °¨½Ã¸¦ Àç°³ÇÕ´Ï´Ù:
    if I_Index =
        Continue
    
    ; ºÎÇÕµÈ ¸í·É¾î¸¦ º¸¿©ÁÖ¾î »ç¿ëÀÚ¸¦ ¾È³»ÇÕ´Ï´Ù:
    I_ThisFullCmd := I_FullCmd%I_Index%
    ToolTip, %I_ThisFullCmd%, A_CaretX, A_CaretY + 20
}



I_HelpHotkey:
WinGetTitle, ActiveTitle, A
IfNotInString, ActiveTitle, %I_Editor%, Return

ToolTip  ; Áö±Ý ´çÀåÀº ÇÊ¿ä°¡ ¾ø±â ¶§¹®¿¡ ±¸¹® µµ¿ò ÅøÆÁÀ» ²ü´Ï´Ù.

SetTitleMatchMode, 1  ; 3ÀÇ °æ¿ì, ÀÌ ¼³Á¤Àº ÀÌ ¾²·¹µå¿¡¸¸ È¿°ú°¡ ÀÖ½À´Ï´Ù.
IfWinNotExist, AutoHotkey Help
{
    IfNotExist, %ahk_help_file%
    {
        MsgBox, Could not find the help file: %ahk_help_file%.
        return
    }
    Run, %ahk_help_file%
    WinWait, AutoHotkey Help
}

if I_ThisCmd =  ; ´ë½Å¿¡, ÃÖ±Ù¿¡ ŸÀÚµÈ °ÍÀ» »ç¿ëÇÕ´Ï´Ù.
    I_ThisCmd := I_Word

; À§¿¡¼­ "¸¶Áö¸· ¹ß°ß" âÀÌ ¼³Á¤µÇ¾ú°í ±×°ÍÀ» ¾Æ·¡¿¡ »ç¿ëÇÕ´Ï´Ù:
WinActivate
WinWaitActive
StringReplace, I_ThisCmd, I_ThisCmd, #, {#}  ; ÀÖ´Ù¸é, ¾ÕÀÇ #¸¦ ±³Ã¼ÇÕ´Ï´Ù.
Send, !n{home}+{end}%I_HelpOn%{enter}
return