201

Re: AHK: Замена стандартного элемента управления "Hotkey"

serzh82saratov пишет:

Можно сделать свой костыль

Спасибо, этого вполне достаточно.

serzh82saratov пишет:

Это не баг, это фича

Именно о новой функции "G"
Вот скрин, в том месте на другой вкладке находится этот хоткей, я про это говорил. Кстати не всегда просвечивается хоткей из другой вкладки.

+ открыть спойлер

https://monosnap.com/file/3jGPDIFHN3jR95XwcqYMYA72XjKdEg.png

202

Re: AHK: Замена стандартного элемента управления "Hotkey"

А, разговор про Tab. Видимо это его недоработки, вы кстати контрол Tab3 используете? Они в Tabе часто что то допиливают.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

203

Re: AHK: Замена стандартного элемента управления "Hotkey"

serzh82saratov
Нет, я если честно и не знал про tab3. В русской викие ничего про это нет, а с английским у меня туговато.

204 (изменено: serzh82saratov, 2016-11-06 22:09:14)

Re: AHK: Замена стандартного элемента управления "Hotkey"

Вы после tab троечку допишите, авось поедет.

Gui, Add, Tab3,, General|View|Appearance|Settings
По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

205

Re: AHK: Замена стандартного элемента управления "Hotkey"

Нет, не прошло, всё так же.

206

Re: AHK: Замена стандартного элемента управления "Hotkey"

Сделаете короткий код с табом, посмотрю.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

207

Re: AHK: Замена стандартного элемента управления "Hotkey"

Сожалею, но я не знаю как короче без всего вашего скрипта.

modkey1 = !F4
modkey2 = !F1
#NoEnv
#SingleInstance Force 
Hotkey_IniPath(A_ScriptDir "\Hotkey.ini")
	Gui, Add, Tab3, x7 y10 h100 w150 cBlue HwndtabID, 1|2
	Gui, Add, Edit, r1 center w120 hwndhmodkey1, % Hotkey_Set("modkey1", modkey1)
	Gui, Tab, 2
	Gui, Add, Edit, r1 center y+45 w120 hwndhmodkey2, % Hotkey_Set("modkey2", modkey2)
	Gui, Show
	Hotkey_Register(["modkey1",hmodkey1,"KG1"]
				, ["modkey2",hmodkey2,"KG1"])
	Return
	
;===========================================================================================
Hotkey_Register(Controls*) {
	Static IsStart
	Local k, v, g, g1
	For k, v in Controls
	{
		Hotkey_ID(v[2], v[1]), Hotkey_ID(v[1], v[2])
		Hotkey_Options(v[2], v[3] = "" ? "K" : v[3])
		Hotkey_Value(v[2], Hotkey_Value(v[1]))
		PostMessage, 0x00CF, 1, , , % "ahk_id" v[2]   ;  EM_SETREADONLY
		If RegExMatch(v[3], "i)G(\d+)", g)
			Hotkey_Group("Set", v[1], g1)
	}
	If IsStart
		Return Hotkey_IsRegFocus()
	#HotkeyInterval 0
	Hotkey_SetWinEventHook(0x8005, 0x8005, 0, RegisterCallback("Hotkey_EventFocus", "F"), 0, 0, 0)   ;  EVENT_OBJECT_FOCUS := 0x8005
	Hotkey_InitHotkeys(), Hotkey_IsRegFocus(), IsStart := 1
}

Hotkey_Main(Param1, Param2 = "") {
	Static OnlyMods, ControlHandle, Hotkey, KeyName, K := {}
	, Prefix := {"LAlt":"<!","LCtrl":"<^","LShift":"<+","LWin":"<#"
				,"RAlt":">!","RCtrl":">^","RShift":">+","RWin":">#"
				,"Alt":"!","Ctrl":"^","Shift":"+","Win":"#"}
	, EngSym := {"sc2":"1","sc3":"2","sc4":"3","sc5":"4","sc6":"5","sc7":"6"
				,"sc8":"7","sc9":"8","scA":"9","scB":"0","scC":"-","scD":"="
				,"sc10":"Q","sc11":"W","sc12":"E","sc13":"R","sc14":"T","sc15":"Y"
				,"sc16":"U","sc17":"I","sc18":"O","sc19":"P","sc1A":"[","sc1B":"]"
				,"sc1E":"A","sc1F":"S","sc20":"D","sc21":"F","sc22":"G","sc23":"H"
				,"sc24":"J","sc25":"K","sc26":"L","sc27":"`;","sc28":"'","sc29":"``"
				,"sc2B":"\","sc2C":"Z","sc2D":"X","sc2E":"C","sc2F":"V","sc30":"B"
				,"sc31":"N","sc32":"M","sc33":",","sc34":".","sc35":"/"}
	Local IsMod, Text

	If Param1 = GetMod
		Return K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	If Param2
	{
		If OnlyMods
		{
			SendMessage, 0xC, 0, "" Hotkey_Arr("Empty"), , ahk_id %ControlHandle%
			OnlyMods := 0, K := {}
		}
		ControlHandle := Param2
		Hotkey_Arr("Hook", Hotkey_Options(ControlHandle))
		PostMessage, 0x00B1, -1, -1, , ahk_id %ControlHandle%   ;  EM_SETSEL
	}
	Else If Hotkey_Arr("Hook")
	{
		Hotkey_Arr("Hook", 0), K := {}
		If OnlyMods
			SendMessage, 0xC, 0, "" Hotkey_Arr("Empty"), , ahk_id %ControlHandle%
		SetTimer, Hotkey_IsRegFocus, -200
	}
	Return

Hotkey_Mods:
	If InStr(Hotkey_Arr("Hook"), "S")
		GoTo Hotkey_View
	IsMod := InStr(Hotkey_Arr("Hook"), "D") ? A_ThisHotkey : SubStr(A_ThisHotkey, 2)
	If (K["M" IsMod] != "")
		Return
	K["M" IsMod] := IsMod "+", K["P" IsMod] := Prefix[IsMod]
	GoTo Hotkey_ViewMod

Hotkey_ModsUp:
	If InStr(Hotkey_Arr("Hook"), "S")
		Return
	IsMod := InStr(Hotkey_Arr("Hook"), "D") ? SubStr(A_ThisHotkey, 1, -3) : SubStr(A_ThisHotkey, 2, -3)
	K["M" IsMod] := "", K["P" IsMod] := ""
	If (Hotkey != "")
		Return

Hotkey_ViewMod:
	Hotkey := "", OnlyMods := 1, Hotkey_Value(Hotkey_ID(ControlHandle), K.Prefix Hotkey), Hotkey_Value(ControlHandle, K.Prefix Hotkey)
	K.Mods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	Text := K.Mods = "" ? Hotkey_Arr("Empty") : K.Mods
	SendMessage, 0xC, 0, &Text, , ahk_id %ControlHandle%
	Return

Hotkey_View:
Hotkey_ViewSC:
	If (A_ThisLabel = "Hotkey_ViewSC")
		KeyName := Hotkey_Arr("OnlyEngSym") ? EngSym[A_ThisHotkey] : Format("{:U}", GetKeyName(A_ThisHotkey))
	Else
		KeyName := A_ThisHotkey
	Hotkey := A_ThisHotkey, OnlyMods := 0
	K.Prefix := K.PLCtrl K.PRCtrl K.PLAlt K.PRAlt K.PLShift K.PRShift K.PLWin K.PRWin K.PCtrl K.PAlt K.PShift K.PWin
	Hotkey_Value(Hotkey_ID(ControlHandle), K.Prefix Hotkey), Hotkey_Value(ControlHandle, K.Prefix Hotkey)
	K.Mods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	Text := K.Mods KeyName = "" ? Hotkey_Arr("Empty") : K.Mods KeyName
	SendMessage, 0xC, 0, &Text, , ahk_id %ControlHandle%
	If Hotkey_Group("Get", Hotkey_ID(ControlHandle)) && Hotkey_Group("SaveCheck", ControlHandle)
		SetTimer, Hotkey_Group, -70
	Return
}

Hotkey_InitHotkeys() {
	Local S_FormatInteger, Name
	Static nmMods := "LAlt|RAlt|LCtrl|RCtrl|LShift|RShift|LWin|RWin"
	, nmMouse := "MButton|WheelDown|WheelUp|WheelRight|WheelLeft|XButton1|XButton2"
	, scSymb := "2|3|4|5|6|7|8|9|A|B|C|D|10|11|12|13|14|15|16|17|18|19|1A|1B|1E|1F|"
		. "20|21|22|23|24|25|26|27|28|29|2B|2C|2D|2E|2F|30|31|32|33|34|35"
	, scNoSymb := "1|E|F|1C|37|39|3A|3B|3C|3D|3E|3F|40|41|42|43|44|45|46|47|48|49|4A|4B|4C|4D|4E|4F|50|51|52|53|54|"
		. "57|58|63|64|65|66|67|68|69|6A|6B|6C|6D|6E|76|11C|135|147|148|149|14B|14D|14F|150|151|152|153|15D"
	, vkOther := "3|13|5F|60|61|62|63|64|65|66|67|68|69|6E|A6|A7|A8|A9|AA|AB|AC|AD|AE|AF|B0|B1|B2|B3|B4|B5|B6|B7"
	#IF Hotkey_IsRegControl()
	#IF Hotkey_Hook("K")
	#IF Hotkey_Hook("M")
	#IF Hotkey_Hook("L") && GetKeyState("RButton", "P")
	#IF Hotkey_Hook("R")
	#IF Hotkey_Hook("J") && !Hotkey_Main("GetMod")
	#IF Hotkey_Arr("Hook") && !Hotkey_Hook("K")
	#IF
	Hotkey, IF, Hotkey_Hook("M")
	Loop, Parse, nmMouse, |
		Hotkey, % A_LoopField, Hotkey_View
	Hotkey, IF, Hotkey_Hook("K")
	Loop, Parse, nmMods, |
	{
		Hotkey, % A_LoopField, Hotkey_Mods
		Hotkey, % A_LoopField " Up", Hotkey_ModsUp
	}
	Loop, Parse, scSymb, |
		Hotkey, % "sc" A_LoopField, Hotkey_ViewSC
	Loop, Parse, scNoSymb, |
		Hotkey, % GetKeyName("sc" A_LoopField), Hotkey_View
	Loop, Parse, vkOther, |
		Hotkey, % GetKeyName("vk" A_LoopField), Hotkey_View
	Hotkey, IF, Hotkey_Hook("L") && GetKeyState("RButton"`, "P")
	Hotkey, LButton, Hotkey_View
	Hotkey, IF, Hotkey_Hook("R")
	Hotkey, RButton, Hotkey_View
	S_FormatInteger := A_FormatInteger
	SetFormat, IntegerFast, D
	Hotkey, IF, Hotkey_Hook("J") && !Hotkey_Main("GetMod")
	Loop, 128
		Hotkey % Ceil(A_Index / 32) "Joy" Mod(A_Index - 1, 32) + 1, Hotkey_View
	SetFormat, IntegerFast, %S_FormatInteger%
	Hotkey, IF, Hotkey_IsRegControl()
	Hotkey, RButton, Hotkey_RButton
	Hotkey, RButton Up, Hotkey_Return
	Hotkey, IF, Hotkey_Arr("Hook") && !Hotkey_Hook("K")
	Hotkey, AppsKey Up, Hotkey_Return
	Hotkey, +F10, Hotkey_Return
	Hotkey, IF
	Return

	Hotkey_RButton:
		Click
	Hotkey_Return:
		Return
}

Hotkey_IsRegControl() {
	Local Control
	MouseGetPos,,,, Control, 2
	Return Hotkey_ID(Control) != ""
}

Hotkey_IsRegFocus() {
	Local ControlNN, hFocus
	ControlGetFocus, ControlNN, A
	ControlGet, hFocus, Hwnd, , %ControlNN%, A
	Hotkey_ID(hFocus) != "" ? Hotkey_Main("Control", hFocus) : 0
}

Hotkey_EventFocus(hWinEventHook, event, hwnd) {
	Hotkey_ID(hwnd) != "" ? Hotkey_Main("Control", hwnd) : Hotkey_Main("Control")
}

Hotkey_SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags) {
	Return DllCall("SetWinEventHook" , "UInt", eventMin, "UInt", eventMax, "Ptr", hmodWinEventProc
			, "Ptr", lpfnWinEventProc, "UInt", idProcess, "UInt", idThread, "UInt", dwFlags, "Ptr")
}

	; -------------------------------------- Save and get --------------------------------------

Hotkey_Arr(P*) {
	Static Arr := {"Empty":"Нет"}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : (Arr[P[1]] := P[2])
}

Hotkey_ID(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_Value(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_Options(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_ChangeOption(ID, Option) {
	Local Hwnd
	Hwnd := (ID + 0 != "") ? ID : Hotkey_ID(ID)
	Return Hotkey_Options(Hwnd, Option)
}

Hotkey_Hook(Option) {
	Return Hotkey_Arr("Hook") && !!InStr(Hotkey_Arr("Hook"), Option)
}

Hotkey_Delete(ID, Destroy=0) {
	Local Hwnd, Name, hFocus, ControlNN
	(ID + 0 = "") ? (Hwnd := Hotkey_ID(ID), Name := ID) : (Hwnd := ID, Name := Hotkey_ID(ID))
	Hotkey_ID(Hwnd, "", 1), Hotkey_ID(Name, "", 1)
	Hotkey_Value(Hwnd, "", 1), Hotkey_Value(Name, "", 1)
	Hotkey_Options(Hwnd, "", 1)
	ControlGetFocus, ControlNN, A
	ControlGet, hFocus, Hwnd, , %ControlNN%, A
	(hFocus = Hwnd ? Hotkey_Main("Control") : 0)
	If Destroy
		DllCall("DestroyWindow", "Ptr", Hwnd)
	Else
		PostMessage, 0x00CF, 0, , , % "ahk_id" Hwnd		;  EM_SETREADONLY
	Return Hwnd
}

Hotkey_Set(Name, Value="") {
	Text := Value = "" ? Hotkey_Arr("Empty") : Hotkey_HKToStr(Value)
	SendMessage, 0xC, 0, &Text, , % "ahk_id" Hotkey_ID(Name)
	Return Hotkey_HKToStr(Value), Hotkey_Value(Name, Value), Hotkey_Value(Hotkey_ID(Name), Value)
}

Hotkey_Read(Name, Section = "", FilePath = "") {
	Local HK
	HK := Hotkey_IniRead(Name, Section, FilePath), Hotkey_Value(Name, HK)
	Return Hotkey_HKToStr(HK)
}

Hotkey_IniPath(Path = "") {
	Return Path = "" ? Hotkey_Arr("IniPath") : Hotkey_Arr("IniPath", Path)
}

Hotkey_IniSection(Section = "") {
	Return Section = "" ? Hotkey_Arr("IniSection") : Hotkey_Arr("IniSection", Section)
}

Hotkey_IniRead(Name, Section = "", FilePath = "") {
	Local Data
	IniRead, Data, % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section = "" ? Hotkey_IniSection() : Section, % Name, % A_Space
	Return Data
}

Hotkey_IniWrite(ID, Section = "", FilePath = "") {
	Local Key
	Key := (ID + 0 = "") ? ID : Hotkey_ID(ID)
	If (Key != "")
		IniWrite, % Hotkey_Value(ID), % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section = "" ? Hotkey_IniSection() : Section, % Key
}

	; -------------------------------------- Group --------------------------------------

Hotkey_Group(Key = "", p1 = "", p2 = "") {
	Local Name, Value, k, v, n, m
	Static NG := {}, GN := [], Blink := [], SaveCheck := [], i := 0
	If (Key = "") {
		For k, Name in SaveCheck
		{
			If ((Value := Hotkey_Value(Name)) != "")
				For m, n in GN[NG[Name]] {
					If (n != Name && Hotkey_Equal(Value, Hotkey_Value(n))) {
						DllCall("ShowWindowAsync", "Ptr", Hotkey_ID(n), "Int", 0)
						Blink[Hotkey_ID(n)] := 1, i := 5, Hotkey_Set(Name)
						SetTimer, Hotkey_BlinkControl, -50
					}
				}
			SaveCheck.Delete(k)
		}
	}
	Else If (Key = "Set")
		NG[p1] := p2, IsObject(GN[p2]) ? GN[p2].Push(p1) : GN[p2] := [p1]
	Else If (Key = "SaveCheck")
		Return 1, SaveCheck[p1] := Hotkey_ID(p1)
	Else If (Key = "Get")
		Return NG[p1] != ""
	Else If (Key = "CheckAll") {
		For k, v in GN
			For k, n in v
				If ((Value := Hotkey_Value(n)) != "")
					For k, m in v
						If (n != m && Hotkey_Equal(Value, Hotkey_Value(m)))
							Hotkey_Set(m)
	}
	Return

	Hotkey_BlinkControl:
		For k in Blink
			DllCall("ShowWindowAsync", "Ptr", k, "Int", Mod(i, 2) ? 4 : 0)
		If (--i > 0) || !(Blink := [])
			SetTimer, Hotkey_BlinkControl, -50
		Return
}

Hotkey_Equal(HK1, HK2) {
	If (HK2 = "")
		Return 0
	If (HK1 = HK2)
		Return 1
	If !(HK1 ~= "S)[\^\+!#]") || !(HK2 ~= "S)[\^\+!#]")
		Return 0
	If (HK1 ~= "S)[<>]") && (HK2 ~= "S)[<>]")
		Return 0
	Return (Hotkey_ModsSub(HK1) = Hotkey_ModsSub(HK2))
}

Hotkey_ModsSub(Value) {
	If !(Value ~= "[<>]")
		Return Value
	ValueSub := StrReplace(Value, "<")
	ValueSub := StrReplace(ValueSub, ">")
	ValueSub := StrReplace(ValueSub, "^^", "^", , 1)
	ValueSub := StrReplace(ValueSub, "!!", "!", , 1)
	ValueSub := StrReplace(ValueSub, "++", "+", , 1)
	Return StrReplace(ValueSub, "##", "#", , 1)
}

	; -------------------------------------- Format --------------------------------------

	; http://forum.script-coding.com/viewtopic.php?pid=105023#p105023

Hotkey_HKToStr(HK) {
	Static LRPrefix := [["<^","LCtrl"],[">^","RCtrl"],["<!","LAlt"],[">!","RAlt"]
					,["<+","LShift"],[">+","RShift"],["<#","LWin"],[">#","RWin"]]
	, Prefix := [["^","Ctrl"],["!","Alt"],["+","Shift"],["#","Win"]]
	, EngSym := {"sc2":"1","sc3":"2","sc4":"3","sc5":"4","sc6":"5","sc7":"6"
				,"sc8":"7","sc9":"8","scA":"9","scB":"0","scC":"-","scD":"="
				,"sc10":"Q","sc11":"W","sc12":"E","sc13":"R","sc14":"T","sc15":"Y"
				,"sc16":"U","sc17":"I","sc18":"O","sc19":"P","sc1A":"[","sc1B":"]"
				,"sc1E":"A","sc1F":"S","sc20":"D","sc21":"F","sc22":"G","sc23":"H"
				,"sc24":"J","sc25":"K","sc26":"L","sc27":"`;","sc28":"'","sc29":"``"
				,"sc2B":"\","sc2C":"Z","sc2D":"X","sc2E":"C","sc2F":"V","sc30":"B"
				,"sc31":"N","sc32":"M","sc33":",","sc34":".","sc35":"/"

				,"vk31":"1","vk32":"2","vk33":"3","vk34":"4","vk35":"5","vk36":"6"
				,"vk37":"7","vk38":"8","vk39":"9","vk30":"0","vkBD":"-","vkBB":"="
				,"vk51":"Q","vk57":"W","vk45":"E","vk52":"R","vk54":"T","vk59":"Y"
				,"vk55":"U","vk49":"I","vk4F":"O","vk50":"P","vkDB":"[","vkDD":"]"
				,"vk41":"A","vk53":"S","vk44":"D","vk46":"F","vk47":"G","vk48":"H"
				,"vk4A":"J","vk4B":"K","vk4C":"L","vkBA":"`;","vkDE":"'","vkC0":"``"
				,"vkDC":"\","vk5A":"Z","vk58":"X","vk43":"C","vk56":"V","vk42":"B"
				,"vk4E":"N","vk4D":"M","vkBC":",","vkBE":".","vkBF":"/"}

	Local K, K1, K2, I, V, M, R
	RegExMatch(HK, "S)^\s*([~\*\$\^\+!#<>]*)\{?(.*?)}?\s*$", K)
	If (K2 = "")
		Return "" Hotkey_Arr("Empty")
	If (InStr("|" K2, "|sc", 1) || InStr("|" K2, "|vk", 1))
		K2 := Hotkey_Arr("OnlyEngSym") && EngSym.HasKey(K2) ? EngSym[K2] : Format("{:U}", GetKeyName(K2))
	If (K1 != "")
		For I, V in K1 ~= "[<>]" ? LRPrefix : Prefix
			K1 := StrReplace(K1, V[1], "", R), R && (M .= V[2] "+")
	Return M . (StrLen(K2) = 1 ? Format("{:U}", K2) : K2)
}

Hotkey_HKToSend(HK, Section = "", FilePath = "") {
	Static LRPrefix := [["<^","LCtrl"],[">^","RCtrl"],["<!","LAlt"],[">!","RAlt"]
					,["<+","LShift"],[">+","RShift"],["<#","LWin"],[">#","RWin"]]
		, Prefix := [["^","LCtrl"],["!","LAlt"],["+","LShift"],["#","LWin"]]
	Local K, K1, K2, I, V, M1, M2, R
	If (HK = "")
		Return
	If (Section != "")
		IniRead, HK, % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section, % HK, % A_Space
	RegExMatch(HK, "S)^\s*([~\*\$\^\+!#<>]*)\{?(.*?)}?\s*$", K)
	If (K1 != "")
		For I, V in K1 ~= "[<>]" ? LRPrefix : Prefix
			K1 := StrReplace(K1, V[1], "", R)
			, R ? (M1 .= "{" V[2] " Down}", M2 .= "{" V[2] " Up}") : 0
	Return M1 . "{" K2 "}" . M2
}

208

Re: AHK: Замена стандартного элемента управления "Hotkey"

Ну мы же с вами знаем о какой версии кода (библиотеки) говорим. Сами же отделили ;======= не нужное.

Так у меня не мелькает.


	;  http://forum.script-coding.com/viewtopic.php?id=8343

Hotkey_Register(Controls*) {
	Static IsStart
	Local k, v, g, g1
	For k, v in Controls
	{
		Hotkey_ID(v[2], v[1]), Hotkey_ID(v[1], v[2])
		Hotkey_Options(v[2], v[3] = "" ? "K" : v[3])
		Hotkey_Value(v[2], Hotkey_Value(v[1]))
		PostMessage, 0x00CF, 1, , , % "ahk_id" v[2]   ;  EM_SETREADONLY
		If RegExMatch(v[3], "i)G(\d+)", g)
			Hotkey_Group("Set", v[1], g1)
	}
	If IsStart
		Return Hotkey_IsRegFocus()
	#HotkeyInterval 0
	Hotkey_SetWinEventHook(0x8005, 0x8005, 0, RegisterCallback("Hotkey_EventFocus", "F"), 0, 0, 0)   ;  EVENT_OBJECT_FOCUS := 0x8005
	Hotkey_InitHotkeys(), Hotkey_IsRegFocus(), IsStart := 1
}

Hotkey_Main(Param1, Param2 = "") {
	Static OnlyMods, ControlHandle, Hotkey, KeyName, K := {}
	, Prefix := {"LAlt":"<!","LCtrl":"<^","LShift":"<+","LWin":"<#"
				,"RAlt":">!","RCtrl":">^","RShift":">+","RWin":">#"
				,"Alt":"!","Ctrl":"^","Shift":"+","Win":"#"}
	, EngSym := {"sc2":"1","sc3":"2","sc4":"3","sc5":"4","sc6":"5","sc7":"6"
				,"sc8":"7","sc9":"8","scA":"9","scB":"0","scC":"-","scD":"="
				,"sc10":"Q","sc11":"W","sc12":"E","sc13":"R","sc14":"T","sc15":"Y"
				,"sc16":"U","sc17":"I","sc18":"O","sc19":"P","sc1A":"[","sc1B":"]"
				,"sc1E":"A","sc1F":"S","sc20":"D","sc21":"F","sc22":"G","sc23":"H"
				,"sc24":"J","sc25":"K","sc26":"L","sc27":"`;","sc28":"'","sc29":"``"
				,"sc2B":"\","sc2C":"Z","sc2D":"X","sc2E":"C","sc2F":"V","sc30":"B"
				,"sc31":"N","sc32":"M","sc33":",","sc34":".","sc35":"/"}
	Local IsMod, Text

	If Param1 = GetMod
		Return K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	If Param2
	{
		If OnlyMods
		{
			SendMessage, 0xC, 0, "" Hotkey_Arr("Empty"), , ahk_id %ControlHandle%
			OnlyMods := 0, K := {}
		}
		ControlHandle := Param2
		Hotkey_Arr("Hook", Hotkey_Options(ControlHandle))
		PostMessage, 0x00B1, -1, -1, , ahk_id %ControlHandle%   ;  EM_SETSEL
	}
	Else If Hotkey_Arr("Hook")
	{
		Hotkey_Arr("Hook", 0), K := {}
		If OnlyMods
			SendMessage, 0xC, 0, "" Hotkey_Arr("Empty"), , ahk_id %ControlHandle%
		SetTimer, Hotkey_IsRegFocus, -200
	}
	Return

Hotkey_Mods:
	If InStr(Hotkey_Arr("Hook"), "S")
		GoTo Hotkey_View
	IsMod := InStr(Hotkey_Arr("Hook"), "D") ? A_ThisHotkey : SubStr(A_ThisHotkey, 2)
	If (K["M" IsMod] != "")
		Return
	K["M" IsMod] := IsMod "+", K["P" IsMod] := Prefix[IsMod]
	GoTo Hotkey_ViewMod

Hotkey_ModsUp:
	If InStr(Hotkey_Arr("Hook"), "S")
		Return
	IsMod := InStr(Hotkey_Arr("Hook"), "D") ? SubStr(A_ThisHotkey, 1, -3) : SubStr(A_ThisHotkey, 2, -3)
	K["M" IsMod] := "", K["P" IsMod] := ""
	If (Hotkey != "")
		Return

Hotkey_ViewMod:
	Hotkey := "", OnlyMods := 1, Hotkey_Value(Hotkey_ID(ControlHandle), K.Prefix Hotkey), Hotkey_Value(ControlHandle, K.Prefix Hotkey)
	K.Mods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	Text := K.Mods = "" ? Hotkey_Arr("Empty") : K.Mods
	SendMessage, 0xC, 0, &Text, , ahk_id %ControlHandle%
	Return

Hotkey_View:
Hotkey_ViewSC:
	If (A_ThisLabel = "Hotkey_ViewSC")
		KeyName := Hotkey_Arr("OnlyEngSym") ? EngSym[A_ThisHotkey] : Format("{:U}", GetKeyName(A_ThisHotkey))
	Else
		KeyName := A_ThisHotkey
	Hotkey := A_ThisHotkey, OnlyMods := 0
	K.Prefix := K.PLCtrl K.PRCtrl K.PLAlt K.PRAlt K.PLShift K.PRShift K.PLWin K.PRWin K.PCtrl K.PAlt K.PShift K.PWin
	Hotkey_Value(Hotkey_ID(ControlHandle), K.Prefix Hotkey), Hotkey_Value(ControlHandle, K.Prefix Hotkey)
	K.Mods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	Text := K.Mods KeyName = "" ? Hotkey_Arr("Empty") : K.Mods KeyName
	SendMessage, 0xC, 0, &Text, , ahk_id %ControlHandle%
	If Hotkey_Group("Get", Hotkey_ID(ControlHandle)) && Hotkey_Group("SaveCheck", ControlHandle)
		SetTimer, Hotkey_Group, -70
	Return
}

Hotkey_InitHotkeys() {
	Local S_FormatInteger, S_BatchLines
	Static nmMods := "LAlt|RAlt|LCtrl|RCtrl|LShift|RShift|LWin|RWin"
	, nmMouse := "MButton|WheelDown|WheelUp|WheelRight|WheelLeft|XButton1|XButton2"
	, scSymb := "2|3|4|5|6|7|8|9|A|B|C|D|10|11|12|13|14|15|16|17|18|19|1A|1B|"
		. "1E|1F|20|21|22|23|24|25|26|27|28|29|2B|2C|2D|2E|2F|30|31|32|33|34|35"
	, scNoSymb := "1|E|F|1C|37|39|3A|3B|3C|3D|3E|3F|40|41|42|43|44|45|46|47|48|49|4A|4B|4C|4D|4E|4F|50|51|52|"
		. "53|54|57|58|63|64|65|66|67|68|69|6A|6B|6C|6D|6E|76|11C|135|147|148|149|14B|14D|14F|150|151|152|153|15D"
	, vkOther := "3|13|5F|60|61|62|63|64|65|66|67|68|69|6E|A6|A7|A8|A9|AA|AB|AC|AD|AE|AF|B0|B1|B2|B3|B4|B5|B6|B7"
	S_BatchLines := A_BatchLines
	SetBatchLines, -1
	#IF Hotkey_IsRegControl()
	#IF Hotkey_Hook("K")
	#IF Hotkey_Hook("M")
	#IF Hotkey_Hook("L") && GetKeyState("RButton", "P")
	#IF Hotkey_Hook("R")
	#IF Hotkey_Hook("J") && !Hotkey_Main("GetMod")
	#IF Hotkey_Arr("Hook") && !Hotkey_Hook("K")
	#IF
	Hotkey, IF, Hotkey_Hook("M")
	Loop, Parse, nmMouse, |
		Hotkey, % A_LoopField, Hotkey_View
	Hotkey, IF, Hotkey_Hook("K")
	Loop, Parse, nmMods, |
	{
		Hotkey, % A_LoopField, Hotkey_Mods
		Hotkey, % A_LoopField " Up", Hotkey_ModsUp
	}
	Loop, Parse, scSymb, |
		Hotkey, % "sc" A_LoopField, Hotkey_ViewSC
	Loop, Parse, scNoSymb, |
		Hotkey, % GetKeyName("sc" A_LoopField), Hotkey_View
	Loop, Parse, vkOther, |
		Hotkey, % GetKeyName("vk" A_LoopField), Hotkey_View
	Hotkey, IF, Hotkey_Hook("L") && GetKeyState("RButton"`, "P")
	Hotkey, LButton, Hotkey_View
	Hotkey, IF, Hotkey_Hook("R")
	Hotkey, RButton, Hotkey_View
	S_FormatInteger := A_FormatInteger
	SetFormat, IntegerFast, D
	Hotkey, IF, Hotkey_Hook("J") && !Hotkey_Main("GetMod")
	Loop, 128
		Hotkey % Ceil(A_Index / 32) "Joy" Mod(A_Index - 1, 32) + 1, Hotkey_View
	SetFormat, IntegerFast, %S_FormatInteger%
	Hotkey, IF, Hotkey_IsRegControl()
	Hotkey, RButton, Hotkey_RButton
	Hotkey, RButton Up, Hotkey_Return
	Hotkey, IF, Hotkey_Arr("Hook") && !Hotkey_Hook("K")
	Hotkey, AppsKey Up, Hotkey_Return
	Hotkey, +F10, Hotkey_Return
	Hotkey, IF
	SetBatchLines, %S_BatchLines%
	Return

	Hotkey_RButton:
		Click
	Hotkey_Return:
		Return
}

Hotkey_IsRegControl() {
	Local Control
	MouseGetPos,,,, Control, 2
	Return Hotkey_ID(Control) != ""
}

Hotkey_IsRegFocus() {
	Local ControlNN, hFocus
	ControlGetFocus, ControlNN, A
	ControlGet, hFocus, Hwnd, , %ControlNN%, A
	Hotkey_ID(hFocus) != "" ? Hotkey_Main("Control", hFocus) : 0
}

Hotkey_EventFocus(hWinEventHook, event, hwnd) {
	Hotkey_ID(hwnd) != "" ? Hotkey_Main("Control", hwnd) : Hotkey_Main("Control")
}

Hotkey_SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags) {
	Return DllCall("SetWinEventHook" , "UInt", eventMin, "UInt", eventMax, "Ptr", hmodWinEventProc
			, "Ptr", lpfnWinEventProc, "UInt", idProcess, "UInt", idThread, "UInt", dwFlags, "Ptr")
}

	; -------------------------------------- Save and get --------------------------------------

Hotkey_Arr(P*) {
	Static Arr := {"Empty":"Нет"}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : (Arr[P[1]] := P[2])
}

Hotkey_ID(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_Value(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_Options(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_ChangeOption(ID, Option) {
	Local Hwnd, Name, g, g1
	(ID + 0 = "") ? (Hwnd := Hotkey_ID(ID), Name := ID) : (Hwnd := ID, Name := Hotkey_ID(ID))
	If RegExMatch(Hotkey_Options(Hwnd), "i)G(\d+)", g)
		Hotkey_Group("Delete", Name)
	If RegExMatch(Option, "i)G(\d+)", g)
		Hotkey_Group("Set", Name, g1)
	Return Hotkey_Options(Hwnd, Option)
}

Hotkey_Hook(Option) {
	Return Hotkey_Arr("Hook") && !!InStr(Hotkey_Arr("Hook"), Option)
}

Hotkey_Delete(ID, Destroy=0) {
	Local Hwnd, Name, hFocus, ControlNN
	(ID + 0 = "") ? (Hwnd := Hotkey_ID(ID), Name := ID) : (Hwnd := ID, Name := Hotkey_ID(ID))
	Hotkey_Group("Delete", Name)
	Hotkey_ID(Hwnd, "", 1), Hotkey_ID(Name, "", 1)
	Hotkey_Value(Hwnd, "", 1), Hotkey_Value(Name, "", 1)
	Hotkey_Options(Hwnd, "", 1)
	ControlGetFocus, ControlNN, A
	ControlGet, hFocus, Hwnd, , %ControlNN%, A
	(hFocus = Hwnd ? Hotkey_Main("Control") : 0)
	If Destroy
		DllCall("DestroyWindow", "Ptr", Hwnd)
	Else
		PostMessage, 0x00CF, 0, , , % "ahk_id" Hwnd		;  EM_SETREADONLY
	Return Hwnd
}

Hotkey_Set(Name, Value="") {
	Local Text
	Text := Hotkey_HKToStr(Value)
	SendMessage, 0xC, 0, &Text, , % "ahk_id" Hotkey_ID(Name)
	Return Text, Hotkey_Value(Name, Value), Hotkey_Value(Hotkey_ID(Name), Value)
}

Hotkey_Read(Name, Section = "", FilePath = "") {
	Local HK
	HK := Hotkey_IniRead(Name, Section, FilePath), Hotkey_Value(Name, HK)
	Return Hotkey_HKToStr(HK)
}

Hotkey_IniPath(Path = "") {
	Return Path = "" ? Hotkey_Arr("IniPath") : Hotkey_Arr("IniPath", Path)
}

Hotkey_IniSection(Section = "") {
	Return Section = "" ? Hotkey_Arr("IniSection") : Hotkey_Arr("IniSection", Section)
}

Hotkey_IniRead(Name, Section = "", FilePath = "") {
	Local Data
	IniRead, Data, % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section = "" ? Hotkey_IniSection() : Section, % Name, % A_Space
	Return Data
}

Hotkey_IniWrite(ID, Section = "", FilePath = "") {
	Local Key
	Key := (ID + 0 = "") ? ID : Hotkey_ID(ID)
	If (Key != "")
		IniWrite, % Hotkey_Value(ID), % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section = "" ? Hotkey_IniSection() : Section, % Key
}

	; -------------------------------------- Group --------------------------------------

Hotkey_Group(Key = "", p1 = "", p2 = "") {
	Local Name, Value, k, v, n, m
	Static NG := {}, GN := [], Blink := [], SaveCheck := [], i := 0
	If (Key = "") {
		For k, Name in SaveCheck {
			If ((Value := Hotkey_Value(Name)) != "")
				For m, n in GN[NG[Name]] {
					If (n != Name && Hotkey_Equal(Value, Hotkey_Value(n))) {
						Hotkey_Set(Name)
						If !DllCall("IsWindowVisible", "Ptr", Hotkey_ID(n))
							Return
						DllCall("ShowWindowAsync", "Ptr", Hotkey_ID(n), "Int", 0)
						Blink[Hotkey_ID(n)] := 1, i := 5
						SetTimer, Hotkey_BlinkControl, -50
					}
				}
			SaveCheck.Delete(k)
		}
	}
	Else If (Key = "Set")
		NG[p1] := p2, IsObject(GN[p2]) ? GN[p2].Push(p1) : GN[p2] := [p1]
	Else If (Key = "SaveCheck")
		Return 1, SaveCheck[p1] := Hotkey_ID(p1)
	Else If (Key = "Get")
		Return NG[p1] != ""
	Else If (Key = "CheckAll") {
		For k, v in GN
			For k, n in v
				If ((Value := Hotkey_Value(n)) != "")
					For k, m in v
						If (n != m && Hotkey_Equal(Value, Hotkey_Value(m)))
							Hotkey_Set(m)
	}
	Else If (Key = "Delete") {
		For k, v in GN[NG[p1]]
			If (v = p1) {
				GN[NG[p1]].RemoveAt(k)
				Break
			}
		NG.Delete(p1)
	}
	Return

	Hotkey_BlinkControl:
		For k in Blink
			DllCall("ShowWindowAsync", "Ptr", k, "Int", Mod(i, 2) ? 4 : 0)
		If (--i > 0) || !(Blink := [])
			SetTimer, Hotkey_BlinkControl, -50
		Return
}

Hotkey_Equal(HK1, HK2) {
	If (HK2 = "")
		Return 0
	If (HK1 = HK2)
		Return 1
	If !(HK1 ~= "S)[\^\+!#]") || !(HK2 ~= "S)[\^\+!#]")
		Return 0
	If (HK1 ~= "S)[<>]") && (HK2 ~= "S)[<>]")
		Return 0
	Return (Hotkey_ModsSub(HK1) = Hotkey_ModsSub(HK2))
}

Hotkey_ModsSub(Value) {
	If !(Value ~= "[<>]")
		Return Value
	Value := StrReplace(Value, "<")
	Value := StrReplace(Value, ">")
	Value := StrReplace(Value, "^^", "^", , 1)
	Value := StrReplace(Value, "!!", "!", , 1)
	Value := StrReplace(Value, "++", "+", , 1)
	Return StrReplace(Value, "##", "#", , 1)
}

	; -------------------------------------- Format --------------------------------------

	; http://forum.script-coding.com/viewtopic.php?pid=105023#p105023

Hotkey_HKToStr(HK) {
	Static LRPrefix := [["<^","LCtrl"],[">^","RCtrl"],["<!","LAlt"],[">!","RAlt"]
					,["<+","LShift"],[">+","RShift"],["<#","LWin"],[">#","RWin"]]
	, Prefix := [["^","Ctrl"],["!","Alt"],["+","Shift"],["#","Win"]]
	, EngSym := {"sc2":"1","sc3":"2","sc4":"3","sc5":"4","sc6":"5","sc7":"6"
				,"sc8":"7","sc9":"8","scA":"9","scB":"0","scC":"-","scD":"="
				,"sc10":"Q","sc11":"W","sc12":"E","sc13":"R","sc14":"T","sc15":"Y"
				,"sc16":"U","sc17":"I","sc18":"O","sc19":"P","sc1A":"[","sc1B":"]"
				,"sc1E":"A","sc1F":"S","sc20":"D","sc21":"F","sc22":"G","sc23":"H"
				,"sc24":"J","sc25":"K","sc26":"L","sc27":"`;","sc28":"'","sc29":"``"
				,"sc2B":"\","sc2C":"Z","sc2D":"X","sc2E":"C","sc2F":"V","sc30":"B"
				,"sc31":"N","sc32":"M","sc33":",","sc34":".","sc35":"/"

				,"vk31":"1","vk32":"2","vk33":"3","vk34":"4","vk35":"5","vk36":"6"
				,"vk37":"7","vk38":"8","vk39":"9","vk30":"0","vkBD":"-","vkBB":"="
				,"vk51":"Q","vk57":"W","vk45":"E","vk52":"R","vk54":"T","vk59":"Y"
				,"vk55":"U","vk49":"I","vk4F":"O","vk50":"P","vkDB":"[","vkDD":"]"
				,"vk41":"A","vk53":"S","vk44":"D","vk46":"F","vk47":"G","vk48":"H"
				,"vk4A":"J","vk4B":"K","vk4C":"L","vkBA":"`;","vkDE":"'","vkC0":"``"
				,"vkDC":"\","vk5A":"Z","vk58":"X","vk43":"C","vk56":"V","vk42":"B"
				,"vk4E":"N","vk4D":"M","vkBC":",","vkBE":".","vkBF":"/"}

	Local K, K1, K2, I, V, M, R
	RegExMatch(HK, "S)^\s*([~\*\$\^\+!#<>]*)\{?(.*?)}?\s*$", K)
	If (K2 = "")
		Return "" Hotkey_Arr("Empty")
	If (InStr("|" K2, "|sc", 1) || InStr("|" K2, "|vk", 1))
		K2 := Hotkey_Arr("OnlyEngSym") && EngSym.HasKey(K2) ? EngSym[K2] : Format("{:U}", GetKeyName(K2))
	If (K1 != "")
		For I, V in K1 ~= "[<>]" ? LRPrefix : Prefix
			K1 := StrReplace(K1, V[1], "", R), R && (M .= V[2] "+")
	Return M . (StrLen(K2) = 1 ? Format("{:U}", K2) : K2)
}

Hotkey_HKToSend(HK, Section = "", FilePath = "") {
	Static LRPrefix := [["<^","LCtrl"],[">^","RCtrl"],["<!","LAlt"],[">!","RAlt"]
					,["<+","LShift"],[">+","RShift"],["<#","LWin"],[">#","RWin"]]
		, Prefix := [["^","LCtrl"],["!","LAlt"],["+","LShift"],["#","LWin"]]
	Local K, K1, K2, I, V, M1, M2, R
	If (HK = "")
		Return
	If (Section != "")
		IniRead, HK, % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section, % HK, % A_Space
	RegExMatch(HK, "S)^\s*([~\*\$\^\+!#<>]*)\{?(.*?)}?\s*$", K)
	If (K1 != "")
		For I, V in K1 ~= "[<>]" ? LRPrefix : Prefix
			K1 := StrReplace(K1, V[1], "", R)
			, R ? (M1 .= "{" V[2] " Down}", M2 .= "{" V[2] " Up}") : 0
	Return M1 . "{" K2 "}" . M2
}
По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

209

Re: AHK: Замена стандартного элемента управления "Hotkey"

Да, точно, я что-то и не подумал что это код и так очевиден.
У меня тоже всё нормально, спасибо.

210

Re: AHK: Замена стандартного элемента управления "Hotkey"

Сделал основной версию (209 пост) с "хоткеями и группами".

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

211 (изменено: serzh82saratov, 2017-01-21 16:58:41)

Re: AHK: Замена стандартного элемента управления "Hotkey"

Добавил возможность вызова своего обработчика повторов в группах. См. пример в конце описания.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

212

Re: AHK: Замена стандартного элемента управления "Hotkey"

serzh82saratov, а почему клавиши цифровой клавиатуры определяются по названиям? Они ведь зависят от состояния NumLock.

Заметил опечатку:

Hotkey, IF, Hotkey_Hook("L") && GetKeyState("RButton"`, "P")

Лишний знак акцента.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

213

Re: AHK: Замена стандартного элемента управления "Hotkey"

teadrinker пишет:

Лишний знак акцента.

Иначе неправильно, обсуждали год назад - http://forum.script-coding.com/viewtopi … 98#p104598.

teadrinker пишет:

а почему клавиши цифровой клавиатуры определяются по названиям?

Вообще от задачи зависит, можно наверное опционально сделать, но только как? Отображать sc коды вместо имён, как то не комильфо.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

214

Re: AHK: Замена стандартного элемента управления "Hotkey"

Отображать-то можно имена, а сохранять в виде кодов. Сейчас в виде имён сохраняются.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

215

Re: AHK: Замена стандартного элемента управления "Hotkey"

Но сделать это надо опционально?

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

216

Re: AHK: Замена стандартного элемента управления "Hotkey"

Можно и опционально. Хотя, трудно представить, что кому-то удобно назначать разные горячие клавиши на цифровой клавиатуре в зависимости от NumLock, по-моему, всё время путать будешь.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

217

Re: AHK: Замена стандартного элемента управления "Hotkey"

Всяко бывает, но как редкий вариант его можно сделать опцией, а по умолчанию сохранять как скан коды. Вообщем подумаю на досуге.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

218

Re: AHK: Замена стандартного элемента управления "Hotkey"

Хотел твою функцию приладить к своему ScreenCatcher'у, собираюсь сделать обновление.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

219

Re: AHK: Замена стандартного элемента управления "Hotkey"

Ок, постараюсь побыстрее, если у тебя всё готово.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

220 (изменено: teadrinker, 2017-06-25 17:03:17)

Re: AHK: Замена стандартного элемента управления "Hotkey"

Ну не то, чтобы прямо всё готово, но осталось это всобачить и описание сочинить.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

221 (изменено: serzh82saratov, 2017-06-27 20:34:10)

Re: AHK: Замена стандартного элемента управления "Hotkey"

N - 11 Numpad клавиш зависящих от состояния Numlock сохраняются по имени, без этой опции как скан код.


Hotkey_Register(Controls*) {
	Static IsStart
	Local k, v, g, g1
	For k, v in Controls
	{
		Hotkey_ID(v[2], v[1]), Hotkey_ID(v[1], v[2])
		Hotkey_Options(v[2], v[3] = "" ? "K" : v[3])
		Hotkey_Value(v[2], Hotkey_Value(v[1]))
		PostMessage, 0x00CF, 1, , , % "ahk_id" v[2]   ;  EM_SETREADONLY
		If RegExMatch(v[3], "i)G(\d+)", g)
			Hotkey_Group("Set", v[1], g1)
	}
	If IsStart
		Return Hotkey_IsRegFocus()
	#HotkeyInterval 0
	Hotkey_SetWinEventHook(0x8005, 0x8005, 0, RegisterCallback("Hotkey_EventFocus", "F"), 0, 0, 0)   ;  EVENT_OBJECT_FOCUS := 0x8005
	Hotkey_InitHotkeys(), Hotkey_IsRegFocus(), IsStart := 1
}

Hotkey_Main(Param1, Param2 = "") {
	Static OnlyMods, ControlHandle, Hotkey, KeyName, K := {}
	, Prefix := {"LAlt":"<!","LCtrl":"<^","LShift":"<+","LWin":"<#"
				,"RAlt":">!","RCtrl":">^","RShift":">+","RWin":">#"
				,"Alt":"!","Ctrl":"^","Shift":"+","Win":"#"}
	, EngSym := {"sc2":"1","sc3":"2","sc4":"3","sc5":"4","sc6":"5","sc7":"6"
				,"sc8":"7","sc9":"8","scA":"9","scB":"0","scC":"-","scD":"="
				,"sc10":"Q","sc11":"W","sc12":"E","sc13":"R","sc14":"T","sc15":"Y"
				,"sc16":"U","sc17":"I","sc18":"O","sc19":"P","sc1A":"[","sc1B":"]"
				,"sc1E":"A","sc1F":"S","sc20":"D","sc21":"F","sc22":"G","sc23":"H"
				,"sc24":"J","sc25":"K","sc26":"L","sc27":"`;","sc28":"'","sc29":"``"
				,"sc2B":"\","sc2C":"Z","sc2D":"X","sc2E":"C","sc2F":"V","sc30":"B"
				,"sc31":"N","sc32":"M","sc33":",","sc34":".","sc35":"/"}
	Local IsMod, Text

	If Param1 = GetMod
		Return K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	If Param2
	{
		If OnlyMods
		{
			SendMessage, 0xC, 0, "" Hotkey_Arr("Empty"), , ahk_id %ControlHandle%
			OnlyMods := 0, K := {}
		}
		ControlHandle := Param2
		Hotkey_Arr("Hook", Hotkey_Options(ControlHandle))
		PostMessage, 0x00B1, -1, -1, , ahk_id %ControlHandle%   ;  EM_SETSEL
	}
	Else If Hotkey_Arr("Hook")
	{
		Hotkey_Arr("Hook", 0), K := {}
		If OnlyMods
			SendMessage, 0xC, 0, "" Hotkey_Arr("Empty"), , ahk_id %ControlHandle%
		SetTimer, Hotkey_IsRegFocus, -200
	}
	Return

Hotkey_Mods:
	If InStr(Hotkey_Arr("Hook"), "S")
		GoTo Hotkey_View
	IsMod := InStr(Hotkey_Arr("Hook"), "D") ? A_ThisHotkey : SubStr(A_ThisHotkey, 2)
	If (K["M" IsMod] != "")
		Return
	K["M" IsMod] := IsMod "+", K["P" IsMod] := Prefix[IsMod]
	GoTo Hotkey_ViewMod

Hotkey_ModsUp:
	If InStr(Hotkey_Arr("Hook"), "S")
		Return
	IsMod := InStr(Hotkey_Arr("Hook"), "D") ? SubStr(A_ThisHotkey, 1, -3) : SubStr(A_ThisHotkey, 2, -3)
	K["M" IsMod] := "", K["P" IsMod] := ""
	If (Hotkey != "")
		Return

Hotkey_ViewMod:
	Hotkey := "", OnlyMods := 1, Hotkey_Value(Hotkey_ID(ControlHandle), K.Prefix Hotkey), Hotkey_Value(ControlHandle, K.Prefix Hotkey)
	K.Mods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	Text := K.Mods = "" ? Hotkey_Arr("Empty") : K.Mods
	SendMessage, 0xC, 0, &Text, , ahk_id %ControlHandle%
	Return

Hotkey_ViewNum:
	 If InStr(Hotkey_Arr("Hook"), "N")
		KeyName := Hotkey := GetKeyName(A_ThisHotkey)
	Else
		KeyName := GetKeyName(A_ThisHotkey), Hotkey := Format("sc{:x}", GetKeySC(A_ThisHotkey))
	GoTo, Hotkey_Put

Hotkey_ViewSC:
	KeyName := Hotkey_Arr("OnlyEngSym") ? EngSym[A_ThisHotkey] : Format("{:U}", GetKeyName(A_ThisHotkey))
	Hotkey := A_ThisHotkey
	GoTo, Hotkey_Put

Hotkey_View:
	KeyName := Hotkey := A_ThisHotkey

Hotkey_Put:
	OnlyMods := 0
	K.Prefix := K.PLCtrl K.PRCtrl K.PLAlt K.PRAlt K.PLShift K.PRShift K.PLWin K.PRWin K.PCtrl K.PAlt K.PShift K.PWin
	Hotkey_Value(Hotkey_ID(ControlHandle), K.Prefix Hotkey), Hotkey_Value(ControlHandle, K.Prefix Hotkey)
	K.Mods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin K.MCtrl K.MAlt K.MShift K.MWin
	Text := K.Mods KeyName = "" ? Hotkey_Arr("Empty") : K.Mods KeyName
	SendMessage, 0xC, 0, &Text, , ahk_id %ControlHandle%
	If Hotkey_Group("Get", Hotkey_ID(ControlHandle)) && Hotkey_Group("SaveCheck", ControlHandle)
		SetTimer, Hotkey_Group, -70
	Return
}

Hotkey_InitHotkeys() {
	Local S_FormatInteger, S_BatchLines
	Static nmMods := "LAlt|RAlt|LCtrl|RCtrl|LShift|RShift|LWin|RWin"
	, nmMouse := "MButton|WheelDown|WheelUp|WheelRight|WheelLeft|XButton1|XButton2"
	, scSymb := "2|3|4|5|6|7|8|9|A|B|C|D|10|11|12|13|14|15|16|17|18|19|1A|1B|"
		. "1E|1F|20|21|22|23|24|25|26|27|28|29|2B|2C|2D|2E|2F|30|31|32|33|34|35"
	; , scNumSymb := "53|52|4F|50|51|4B|4C|4D|47|48|49"
	, scOther := "1|E|F|1C|37|39|3A|3B|3C|3D|3E|3F|40|41|42|43|44|45|46|4A|4E|54|57|58|63|64|65|"
		. "66|67|68|69|6A|6B|6C|6D|6E|76|11C|135|147|148|149|14B|14D|14F|150|151|152|153|15D"
	, vkNum := "2E|6E|60|2D|61|23|62|28|63|22|64|25|65|C|66|27|67|24|68|26|69"
	, vkOther := "3|13|5F|A6|A7|A8|A9|AA|AB|AC|AD|AE|AF|B0|B1|B2|B3|B4|B5|B6|B7"
	S_BatchLines := A_BatchLines
	SetBatchLines, -1
	#IF Hotkey_IsRegControl()
	#IF Hotkey_Hook("K")
	#IF Hotkey_Hook("M")
	#IF Hotkey_Hook("L") && GetKeyState("RButton", "P")
	#IF Hotkey_Hook("R")
	#IF Hotkey_Hook("J") && !Hotkey_Main("GetMod")
	#IF Hotkey_Arr("Hook") && !Hotkey_Hook("K")
	#IF
	Hotkey, IF, Hotkey_Hook("M")
	Loop, Parse, nmMouse, |
		Hotkey, % A_LoopField, Hotkey_View
	Hotkey, IF, Hotkey_Hook("K")
	Loop, Parse, nmMods, |
	{
		Hotkey, % A_LoopField, Hotkey_Mods
		Hotkey, % A_LoopField " Up", Hotkey_ModsUp
	}
	Loop, Parse, scSymb, |
		Hotkey, % "sc" A_LoopField, Hotkey_ViewSC
	Loop, Parse, scOther, |
		Hotkey, % GetKeyName("sc" A_LoopField), Hotkey_View
	Loop, Parse, vkNum, |
		Hotkey, % "vk" A_LoopField, Hotkey_ViewNum
	Loop, Parse, vkOther, |
		Hotkey, % GetKeyName("vk" A_LoopField), Hotkey_View
	Hotkey, IF, Hotkey_Hook("L") && GetKeyState("RButton"`, "P")
	Hotkey, LButton, Hotkey_View
	Hotkey, IF, Hotkey_Hook("R")
	Hotkey, RButton, Hotkey_View
	S_FormatInteger := A_FormatInteger
	SetFormat, IntegerFast, D
	Hotkey, IF, Hotkey_Hook("J") && !Hotkey_Main("GetMod")
	Loop, 128
		Hotkey % Ceil(A_Index / 32) "Joy" Mod(A_Index - 1, 32) + 1, Hotkey_View
	SetFormat, IntegerFast, %S_FormatInteger%
	Hotkey, IF, Hotkey_IsRegControl()
	Hotkey, RButton, Hotkey_RButton
	Hotkey, RButton Up, Hotkey_Return
	Hotkey, IF, Hotkey_Arr("Hook") && !Hotkey_Hook("K")
	Hotkey, AppsKey Up, Hotkey_Return
	Hotkey, +F10, Hotkey_Return
	Hotkey, IF
	SetBatchLines, %S_BatchLines%
	Return

	Hotkey_RButton:
		Click
	Hotkey_Return:
		Return
}

Hotkey_IsRegControl() {
	Local Control
	MouseGetPos,,,, Control, 2
	Return Hotkey_ID(Control) != ""
}

Hotkey_IsRegFocus() {
	Local ControlNN, hFocus
	ControlGetFocus, ControlNN, A
	ControlGet, hFocus, Hwnd, , %ControlNN%, A
	Hotkey_ID(hFocus) != "" ? Hotkey_Main("Control", hFocus) : 0
}

Hotkey_EventFocus(hWinEventHook, event, hwnd) {
	Hotkey_ID(hwnd) != "" ? Hotkey_Main("Control", hwnd) : Hotkey_Main("Control")
}

Hotkey_SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags) {
	Return DllCall("SetWinEventHook" , "UInt", eventMin, "UInt", eventMax, "Ptr", hmodWinEventProc
			, "Ptr", lpfnWinEventProc, "UInt", idProcess, "UInt", idThread, "UInt", dwFlags, "Ptr")
}

	; -------------------------------------- Save and get --------------------------------------

Hotkey_Arr(P*) {
	Static Arr := {"Empty":"Нет"}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : (Arr[P[1]] := P[2])
}

Hotkey_ID(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_Value(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_Options(P*) {
	Static Arr := {}
	Return P.MaxIndex() = 1 ? Arr[P[1]] : P.MaxIndex() = 2 ? (Arr[P[1]] := P[2]) : Arr.Delete(P[1])
}

Hotkey_ChangeOption(ID, Option) {
	Local Hwnd, Name, g, g1
	(ID + 0 = "") ? (Hwnd := Hotkey_ID(ID), Name := ID) : (Hwnd := ID, Name := Hotkey_ID(ID))
	If RegExMatch(Hotkey_Options(Hwnd), "i)G(\d+)", g)
		Hotkey_Group("Delete", Name)
	If RegExMatch(Option, "i)G(\d+)", g)
		Hotkey_Group("Set", Name, g1)
	Return Hotkey_Options(Hwnd, Option)
}

Hotkey_Hook(Option) {
	Return Hotkey_Arr("Hook") && !!InStr(Hotkey_Arr("Hook"), Option)
}

Hotkey_Delete(ID, Destroy = 0) {
	Local Hwnd, Name, hFocus, ControlNN
	(ID + 0 = "") ? (Hwnd := Hotkey_ID(ID), Name := ID) : (Hwnd := ID, Name := Hotkey_ID(ID))
	Hotkey_Group("Delete", Name)
	Hotkey_ID(Hwnd, "", 1), Hotkey_ID(Name, "", 1)
	Hotkey_Value(Hwnd, "", 1), Hotkey_Value(Name, "", 1)
	Hotkey_Options(Hwnd, "", 1)
	ControlGetFocus, ControlNN, A
	ControlGet, hFocus, Hwnd, , %ControlNN%, A
	(hFocus = Hwnd ? Hotkey_Main("Control") : 0)
	If Destroy
		DllCall("DestroyWindow", "Ptr", Hwnd)
	Else
		PostMessage, 0x00CF, 0, , , % "ahk_id" Hwnd		;  EM_SETREADONLY
	Return Hwnd
}

Hotkey_Set(Name, Value = "") {
	Local Text
	Text := Hotkey_HKToStr(Value)
	SendMessage, 0xC, 0, &Text, , % "ahk_id" Hotkey_ID(Name)
	Return Text, Hotkey_Value(Name, Value), Hotkey_Value(Hotkey_ID(Name), Value)
}

Hotkey_Read(Name, Section = "", FilePath = "") {
	Local HK
	HK := Hotkey_IniRead(Name, Section, FilePath), Hotkey_Value(Name, HK)
	Return Hotkey_HKToStr(HK)
}

Hotkey_IniPath(Path = "") {
	Return Path = "" ? Hotkey_Arr("IniPath") : Hotkey_Arr("IniPath", Path)
}

Hotkey_IniSection(Section = "") {
	Return Section = "" ? Hotkey_Arr("IniSection") : Hotkey_Arr("IniSection", Section)
}

Hotkey_IniRead(Name, Section = "", FilePath = "") {
	Local Data
	IniRead, Data, % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section = "" ? Hotkey_IniSection() : Section, % Name, % A_Space
	Return Data
}

Hotkey_IniWrite(ID, Section = "", FilePath = "") {
	Local Key
	Key := (ID + 0 = "") ? ID : Hotkey_ID(ID)
	If (Key != "")
		IniWrite, % Hotkey_Value(ID), % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section = "" ? Hotkey_IniSection() : Section, % Key
}

	; -------------------------------------- Group --------------------------------------

Hotkey_Group(Key = "", p1 = "", p2 = "") {
	Local Name, Value, k, v, n, m, f, r
	Static NG := {}, GN := [], Blink := [], SaveCheck := [], i := 0
	If (Key = "") {
		For k, Name in SaveCheck {
			If ((Value := Hotkey_Value(Name)) != "") {
				(f := Hotkey_Arr("GroupEvents")) != "" && (r := {}, r.names := [])
				For m, n in GN[NG[Name]] {
					If (n != Name && Hotkey_Equal(Value, Hotkey_Value(n))) {
						Hotkey_Set(Name)
						(f != "") && (r.names.Push(n), r.this := Name, r.value := Value, r.group := NG[Name])
						If !DllCall("IsWindowVisible", "Ptr", Hotkey_ID(n))
							Continue
						DllCall("ShowWindowAsync", "Ptr", Hotkey_ID(n), "Int", 0)
						Blink[Hotkey_ID(n)] := 1, i := 3
						SetTimer, Hotkey_BlinkControl, -50
					}
				}
			}
			SaveCheck.Delete(k)
		}
		(f != "") && (r.this != "") && %f%(r)
	}
	Else If (Key = "Set")
		NG[p1] := p2, IsObject(GN[p2]) ? GN[p2].Push(p1) : GN[p2] := [p1]
	Else If (Key = "SaveCheck")
		Return 1, SaveCheck[p1] := Hotkey_ID(p1)
	Else If (Key = "Get")
		Return NG[p1] != ""
	Else If (Key = "CheckAll") {
		For k, v in GN
			For k, n in v
				If ((Value := Hotkey_Value(n)) != "")
					For k, m in v
						If (n != m && Hotkey_Equal(Value, Hotkey_Value(m)))
							Hotkey_Set(m)
	}
	Else If (Key = "Delete") {
		For k, v in GN[NG[p1]]
			If (v = p1) {
				GN[NG[p1]].RemoveAt(k)
				Break
			}
		NG.Delete(p1)
	}
	Return

	Hotkey_BlinkControl:
		For k in Blink
			DllCall("ShowWindowAsync", "Ptr", k, "Int", Mod(i, 2) ? 4 : 0)
		If (--i > 0) || !(Blink := [])
			SetTimer, Hotkey_BlinkControl, -50
		Return
}

Hotkey_Equal(HK1, HK2) {
	If (HK2 = "")
		Return 0
	If (HK1 = HK2)
		Return 1
	If !(HK1 ~= "S)[\^\+!#]") || !(HK2 ~= "S)[\^\+!#]")
		Return 0
	If (HK1 ~= "S)[<>]") && (HK2 ~= "S)[<>]")
		Return 0
	Return (Hotkey_ModsSub(HK1) = Hotkey_ModsSub(HK2))
}

Hotkey_ModsSub(Value) {
	If !(Value ~= "[<>]")
		Return Value
	Value := StrReplace(Value, "<")
	Value := StrReplace(Value, ">")
	Value := StrReplace(Value, "^^", "^", , 1)
	Value := StrReplace(Value, "!!", "!", , 1)
	Value := StrReplace(Value, "++", "+", , 1)
	Return StrReplace(Value, "##", "#", , 1)
}

	; -------------------------------------- Format --------------------------------------

	; http://forum.script-coding.com/viewtopic.php?pid=105023#p105023

Hotkey_HKToStr(HK) {
	Static LRPrefix := [["<^","LCtrl"],[">^","RCtrl"],["<!","LAlt"],[">!","RAlt"]
					,["<+","LShift"],[">+","RShift"],["<#","LWin"],[">#","RWin"]]
	, Prefix := [["^","Ctrl"],["!","Alt"],["+","Shift"],["#","Win"]]
	, EngSym := {"sc2":"1","sc3":"2","sc4":"3","sc5":"4","sc6":"5","sc7":"6"
				,"sc8":"7","sc9":"8","scA":"9","scB":"0","scC":"-","scD":"="
				,"sc10":"Q","sc11":"W","sc12":"E","sc13":"R","sc14":"T","sc15":"Y"
				,"sc16":"U","sc17":"I","sc18":"O","sc19":"P","sc1A":"[","sc1B":"]"
				,"sc1E":"A","sc1F":"S","sc20":"D","sc21":"F","sc22":"G","sc23":"H"
				,"sc24":"J","sc25":"K","sc26":"L","sc27":"`;","sc28":"'","sc29":"``"
				,"sc2B":"\","sc2C":"Z","sc2D":"X","sc2E":"C","sc2F":"V","sc30":"B"
				,"sc31":"N","sc32":"M","sc33":",","sc34":".","sc35":"/"

				,"vk31":"1","vk32":"2","vk33":"3","vk34":"4","vk35":"5","vk36":"6"
				,"vk37":"7","vk38":"8","vk39":"9","vk30":"0","vkBD":"-","vkBB":"="
				,"vk51":"Q","vk57":"W","vk45":"E","vk52":"R","vk54":"T","vk59":"Y"
				,"vk55":"U","vk49":"I","vk4F":"O","vk50":"P","vkDB":"[","vkDD":"]"
				,"vk41":"A","vk53":"S","vk44":"D","vk46":"F","vk47":"G","vk48":"H"
				,"vk4A":"J","vk4B":"K","vk4C":"L","vkBA":"`;","vkDE":"'","vkC0":"``"
				,"vkDC":"\","vk5A":"Z","vk58":"X","vk43":"C","vk56":"V","vk42":"B"
				,"vk4E":"N","vk4D":"M","vkBC":",","vkBE":".","vkBF":"/"}

	Local K, K1, K2, I, V, M, R
	RegExMatch(HK, "S)^\s*([~\*\$\^\+!#<>]*)\{?(.*?)}?\s*$", K)
	If (K2 = "")
		Return "" Hotkey_Arr("Empty")
	If (InStr("|" K2, "|sc") || InStr("|" K2, "|vk"))
		K2 := Hotkey_Arr("OnlyEngSym") && EngSym.HasKey(K2) ? EngSym[K2] : GetKeyName(K2)
	If (K1 != "")
		For I, V in K1 ~= "[<>]" ? LRPrefix : Prefix
			K1 := StrReplace(K1, V[1], "", R), R && (M .= V[2] "+")
	Return M . (StrLen(K2) = 1 ? Format("{:U}", K2) : K2)
}

Hotkey_HKToSend(HK, Section = "", FilePath = "") {
	Static LRPrefix := [["<^","LCtrl"],[">^","RCtrl"],["<!","LAlt"],[">!","RAlt"]
					,["<+","LShift"],[">+","RShift"],["<#","LWin"],[">#","RWin"]]
		, Prefix := [["^","LCtrl"],["!","LAlt"],["+","LShift"],["#","LWin"]]
	Local K, K1, K2, I, V, M1, M2, R
	If (HK = "")
		Return
	If (Section != "")
		IniRead, HK, % FilePath = "" ? Hotkey_IniPath() : FilePath, % Section, % HK, % A_Space
	RegExMatch(HK, "S)^\s*([~\*\$\^\+!#<>]*)\{?(.*?)}?\s*$", K)
	If (K1 != "")
		For I, V in K1 ~= "[<>]" ? LRPrefix : Prefix
			K1 := StrReplace(K1, V[1], "", R)
			, R ? (M1 .= "{" V[2] " Down}", M2 .= "{" V[2] " Up}") : 0
	Return M1 . "{" K2 "}" . M2
}
По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

222

Re: AHK: Замена стандартного элемента управления "Hotkey"

У нас тут была баталия по поводу мультимедийных клавиш. А сейчас твой код определяет их коды и названия?
Когда я запускаю первый демонстрационный пример, дописывая туда

Sleep, 3000
SendLevel, 1
SendInput, {VOLUME_UP}

то определяет, как B и sc30.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

223 (изменено: serzh82saratov, 2017-07-04 15:09:50)

Re: AHK: Замена стандартного элемента управления "Hotkey"

Если нажимать клавишу то определяет верно, для данных целей думаю пойдёт.

У меня в коде хоткеи на ММ установлены по именам.
А так вообще не понятно, тут с #If и без по разному идёт вызов.

Sleep, 1000
SendLevel, 1
Send {VOLUME_UP}
Return
#If 1= 1
VOLUME_UP::
sc130::
vkAF::MsgBox % A_ThisHotkey
По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).

224 (изменено: Malcev, 2017-07-04 15:15:56)

Re: AHK: Замена стандартного элемента управления "Hotkey"

Просто при закомментировании "#If 1= 1" VOLUME_UP устанавливается через reg метод.
А такие хотки не воздействуются Sendlevelом.

Hotkeys using the "reg" method are incapable of distinguishing physical and artificial input, so are not affected by SendLevel. However, hotkeys above level 0 always use the keyboard or mouse hook.

https://autohotkey.com/docs/commands/SendLevel.htm

225

Re: AHK: Замена стандартного элемента управления "Hotkey"

Как понять не воздействуются? Запускается же.

По вопросам возмездной помощи пишите письма
E-Mail: serzh82saratov@mail.ru
OS: Win7x64, AutoHotkey_L v1.1.28.02 (Unicode 32-bit).