Now uses window ID instead of PID
This commit is contained in:
28
Echo.ahk
28
Echo.ahk
@@ -5,8 +5,8 @@ SetWorkingDir %A_ScriptDir%
|
|||||||
#SingleInstance force
|
#SingleInstance force
|
||||||
#Persistent
|
#Persistent
|
||||||
|
|
||||||
SetKeyDelay, 0
|
SetKeyDelay, -1, 100
|
||||||
SetControlDelay, 100
|
SetControlDelay, 500
|
||||||
|
|
||||||
ih := InputHook("B")
|
ih := InputHook("B")
|
||||||
ih.KeyOpt("{All}", "NV")
|
ih.KeyOpt("{All}", "NV")
|
||||||
@@ -61,7 +61,8 @@ OnKeyDown(InputHook, VK, SC) {
|
|||||||
}
|
}
|
||||||
if (whitelistKeys.HasKey(key)) {
|
if (whitelistKeys.HasKey(key)) {
|
||||||
for k, v in enabledWindows[1] {
|
for k, v in enabledWindows[1] {
|
||||||
ControlSend,, {%key% down}, ahk_pid %v%
|
; ControlSend,, {%key% down}, ahk_pid %v%
|
||||||
|
ControlSend,, {%key% down}, ahk_id %v%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!keyLog.HasKey(key)) {
|
if (!keyLog.HasKey(key)) {
|
||||||
@@ -75,7 +76,8 @@ OnKeyUp(InputHook, VK, SC) {
|
|||||||
key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC))
|
key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC))
|
||||||
if (whitelistKeys.HasKey(key)) {
|
if (whitelistKeys.HasKey(key)) {
|
||||||
for k, v in enabledWindows[1] {
|
for k, v in enabledWindows[1] {
|
||||||
ControlSend,, {%key% up}, ahk_pid %v%
|
; ControlSend,, {%key% up}, ahk_pid %v%
|
||||||
|
ControlSend,, {%key% up}, ahk_id %v%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,13 +245,14 @@ WhitelistKeys(string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddCurrentWindow() {
|
AddCurrentWindow() {
|
||||||
WinGet, activePID, PID, A
|
; WinGet, activePID, PID, A
|
||||||
if (!Find(enabledWindows[1], activePID)) {
|
WinGet, activeID, ID, A
|
||||||
|
if (!Find(enabledWindows[1], activeID)) {
|
||||||
WinGet, activeName, ProcessName, A
|
WinGet, activeName, ProcessName, A
|
||||||
enabledWindows[1].Insert(activePID)
|
enabledWindows[1].Insert(activeID)
|
||||||
enabledWindows[2].Insert(activeName)
|
enabledWindows[2].Insert(activeName)
|
||||||
sstring := "Added "
|
sstring := "Added "
|
||||||
sstring .= activePID
|
sstring .= activeID
|
||||||
sstring .= " ("
|
sstring .= " ("
|
||||||
sstring .= activeName
|
sstring .= activeName
|
||||||
sstring .= ") to echo list"
|
sstring .= ") to echo list"
|
||||||
@@ -258,13 +261,14 @@ AddCurrentWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoveCurrentWindow() {
|
RemoveCurrentWindow() {
|
||||||
WinGet, activePID, PID, A
|
; WinGet, activePID, PID, A
|
||||||
if (Find(enabledWindows[1], activePID)) {
|
WinGet, activeID, ID, A
|
||||||
|
if (Find(enabledWindows[1], activeID)) {
|
||||||
WinGet, activeName, ProcessName, A
|
WinGet, activeName, ProcessName, A
|
||||||
enabledWindows[1].RemoveAt(Find(enabledWindows[1], activePID))
|
enabledWindows[1].RemoveAt(Find(enabledWindows[1], activeID))
|
||||||
enabledWindows[2].RemoveAt(Find(enabledWindows[2], activeName))
|
enabledWindows[2].RemoveAt(Find(enabledWindows[2], activeName))
|
||||||
sstring := "Removed "
|
sstring := "Removed "
|
||||||
sstring .= activePID
|
sstring .= activeID
|
||||||
sstring .= " ("
|
sstring .= " ("
|
||||||
sstring .= activeName
|
sstring .= activeName
|
||||||
sstring .= ") from echo list"
|
sstring .= ") from echo list"
|
||||||
|
Reference in New Issue
Block a user