툴팁 마우스 메뉴 (XP/2k/NT 요구) -- by Rajat
이 스크립트는 가운데 버튼을 잠깐 누르는데 응답하여 팝업 메뉴를 보여줍니다. 왼클릭하여 메뉴 항목을 선택합니다. 바깥에서 좌클릭하면 메뉴를 취소합니다. 최근에 어느 유형의 창이 활성화되어 있는가에 따라 메뉴의 내용이 변하도록 개선되었습니다. (여기에서는 Notepad와 Word를 예제로 사용합니다).
이 스크립트 내려 받기 | 다른 샘플 스크립트 | 홈으로
; 메뉴에 대하여 여기에서 제목을 설정할 수 있습니다: MenuTitle = -=-=-=-=-=-=-=- ; 다음은 얼마나 오래 버튼을 눌러야 메뉴를 보여줄지 결정합니다: UMDelay = 20 SetFormat, float, 0.0 SetBatchLines, 10ms SetTitleMatchMode, 2 #SingleInstance ;___________________________________________ ;_____메뉴 정의______________________ ; 여기에서 메뉴 항목을 만들고 수정합니다. ; keys/values/section 이름에 스페이스를 사용하면 안 됩니다. ; 순서는 신경쓰지 않아도 됩니다. 메뉴는 정렬됩니다. MenuItems = Notepad/Calculator/Section 3/Section 4/Section 5 ;___________________________________________ ;______동적인 메뉴 항목 정의_______________ ; 구문: ; Dyn# = 메뉴 항목|창 제목 Dyn1 = MS Word|- Microsoft Word Dyn2 = Notepad II|- Notepad ;___________________________________________ Exit ;___________________________________________ ;_____메뉴 섹션_________________________ ; 여기에 메뉴 섹션을 생성하고 편집합니다. Notepad: Run, Notepad.exe Return Calculator: Run, Calc Return Section3: MsgBox, You selected 3 Return Section4: MsgBox, You selected 4 Return Section5: MsgBox, You selected 5 Return MSWord: msgbox, this is a dynamic entry (word) Return NotepadII: msgbox, this is a dynamic entry (notepad) Return ;___________________________________________ ;_____핫키 섹션________________________ ~MButton:: HowLong = 0 Loop { HowLong ++ Sleep, 10 GetKeyState, MButton, MButton, P IfEqual, MButton, U, Break } IfLess, HowLong, %UMDelay%, Return ; 동적 메뉴를 준비합니다 DynMenu = Loop { IfEqual, Dyn%a_index%,, Break StringGetPos, ppos, dyn%a_index%, | StringLeft, item, dyn%a_index%, %ppos% ppos += 2 StringMid, win, dyn%a_index%, %ppos%, 1000 IfWinActive, %win%, DynMenu = %DynMenu%/%item% } ; 정렬된 메인 메뉴와 동적 메뉴를 결합합니다 Sort, MenuItems, D/ TempMenu = %MenuItems%%DynMenu% ; 이전 엔트리들을 지웁니다 Loop { IfEqual, MenuItem%a_index%,, Break MenuItem%a_index% = } ; 새 엔트리들을 생성합니다 Loop, Parse, TempMenu, / { MenuItem%a_index% = %a_loopfield% } ; 메뉴를 생성합니다 Menu = %MenuTitle% Loop { IfEqual, MenuItem%a_index%,, Break numItems ++ StringTrimLeft, MenuText, MenuItem%a_index%, 0 Menu = %Menu%`n%MenuText% } MouseGetPos, mX, mY HotKey, ~LButton, MenuClick HotKey, ~LButton, On ToolTip, %Menu%, %mX%, %mY% WinActivate, %MenuTitle% Return MenuClick: HotKey, ~LButton, Off IfWinNotActive, %MenuTitle% { ToolTip Return } MouseGetPos, mX, mY ToolTip mY -= 3 ; 첫 줄이 시작하면 뒤에 스페이스 mY /= 13 ; 각 줄마다 스페이스 IfLess, mY, 1, Return IfGreater, mY, %numItems%, Return StringTrimLeft, TargetSection, MenuItem%mY%, 0 StringReplace, TargetSection, TargetSection, %a_space%,, A Gosub, %TargetSection% Return