![]() |
#7 |
Участник
|
Там нет клавиш. Лично мне кстати, еще хорошо бы какой-нибудь способ вызова скриптов в редакторе по хоткеям. А то вот я пытался сделать и обломился....
Код макроса на autohotkey X++: PI_GetMenuItemID( hMenu, nPos ) { return DllCall("GetMenuItemID", "uint", hMenu, "int", nPos) } API_GetSubmenu( hMenu, nPos ) { return DllCall("GetSubMenu", "uint", hMenu, "int", nPos) } API_GetMenuItemsCount(hMenu) { return DllCall("GetMenuItemCount", "Uint", hMenu, "Uint") } GetMenuString(hMenu, nPos) { length := DllCall("GetMenuString" , "UInt", hMenu , "UInt", nPos , "UInt", 0 ; NULL , "Int", 0 ; Get length , "UInt", 0x0400) ; MF_BYPOSITION VarSetCapacity(lpString, length + 1) ; I don't check the result... length := DllCall("GetMenuString" , "UInt", hMenu , "UInt", nPos , "Str", lpString , "Int", length + 1 , "UInt", 0x0400) return lpString } findMenuItem(hMenu, name) { RepeatCount := API_GetMenuItemsCount(hMenu) Loop %RepeatCount% { nPos := A_Index - 1 if GetMenuString(hMenu, nPos)=name { return nPos } } return -1 } runScript(name, name2="") { SendInput,{APPSKEY} Sleep, 100 if WinExist("ahk_class #32768") { ;WinGet, activeWindow, ID ;hWnd := activeWindow ;activeWindow := DllCall("GetWindow", "Uint", activeWindow, "Uint", 4, "Uint") SendMessage,0x01E1 hmenu := ErrorLevel nPos := -1 nPos2 := -1 if hmenu!=1 { itemCount := API_GetMenuItemsCount(hmenu) if(findMenuItem(hmenu, "Scripts")=(itemCount-1)) { hmenu := API_GetSubMenu(hmenu, itemCount-1) nPos := findMenuItem(hmenu, name) ;MsgBox % "m2 " . nPos if(nPos != -1 and name2 != "") { hMenu2 := API_GetSubMenu(hmenu, nPos) nPos2 := findMenuItem(hmenu2, name2) ;MsgBox % "m2 " . nPos2 } if((nPos2 != -1) or (nPos != -1 and name2 = "")) { SendInput,{UP}{ENTER} Loop %nPos% { SendInput,{DOWN} } SendInput,{ENTER} if(name2 <> "") { Loop %nPos2% { SendInput,{DOWN} } SendInput,{ENTER} } } } } } } |
|