Windows can now be added with Ctrl+Alt+S and deleted with Ctrl+Alt+D (affects current window only)
This commit is contained in:
41
Echo.ahk
41
Echo.ahk
@@ -147,7 +147,7 @@ AllWindowsToString() {
|
|||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
HasVal(arr, val) {
|
Find(arr, val) {
|
||||||
for k, v in arr {
|
for k, v in arr {
|
||||||
if (v == val) {
|
if (v == val) {
|
||||||
return k
|
return k
|
||||||
@@ -164,7 +164,7 @@ EnableWindows(istring) {
|
|||||||
enabledWindows.Push(Array())
|
enabledWindows.Push(Array())
|
||||||
if (InStr(istring, "|") == 0) {
|
if (InStr(istring, "|") == 0) {
|
||||||
ostring := StrSplit(istring, ", ")
|
ostring := StrSplit(istring, ", ")
|
||||||
if (!HasVal(enabledWindows[1], (ostring[1]))) {
|
if (!Find(enabledWindows[1], (ostring[1]))) {
|
||||||
enabledWindows[1].Push(ostring[1])
|
enabledWindows[1].Push(ostring[1])
|
||||||
enabledWindows[2].Push(ostring[2])
|
enabledWindows[2].Push(ostring[2])
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ EnableWindows(istring) {
|
|||||||
ostring := StrSplit(istring, "|")
|
ostring := StrSplit(istring, "|")
|
||||||
for k, v in ostring {
|
for k, v in ostring {
|
||||||
ostring2 := StrSplit(v, ", ")
|
ostring2 := StrSplit(v, ", ")
|
||||||
if (!HasVal(enabledWindows[1], (ostring2[1]))) {
|
if (!Find(enabledWindows[1], (ostring2[1]))) {
|
||||||
enabledWindows[1].Push(ostring2[1])
|
enabledWindows[1].Push(ostring2[1])
|
||||||
enabledWindows[2].Push(ostring2[2])
|
enabledWindows[2].Push(ostring2[2])
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ EnableWindows(istring) {
|
|||||||
GuiSelectActiveWindows(allWindows) {
|
GuiSelectActiveWindows(allWindows) {
|
||||||
output := Array()
|
output := Array()
|
||||||
for k, v in allWindows[1] {
|
for k, v in allWindows[1] {
|
||||||
if (HasVal(enabledWindows[1], "" v)) {
|
if (Find(enabledWindows[1], "" v)) {
|
||||||
; GuiControl, Choose, WindowListGUI, k
|
; GuiControl, Choose, WindowListGUI, k
|
||||||
output.Push(k)
|
output.Push(k)
|
||||||
}
|
}
|
||||||
@@ -237,9 +237,32 @@ WhitelistKeys(string) {
|
|||||||
|
|
||||||
AddCurrentWindow() {
|
AddCurrentWindow() {
|
||||||
WinGet, activePID, PID, A
|
WinGet, activePID, PID, A
|
||||||
|
if (!Find(enabledWindows[1], activePID)) {
|
||||||
WinGet, activeName, ProcessName, A
|
WinGet, activeName, ProcessName, A
|
||||||
enabledWindows[1].Insert(activePID)
|
enabledWindows[1].Insert(activePID)
|
||||||
enabledWindows[2].Insert(activeName)
|
enabledWindows[2].Insert(activeName)
|
||||||
|
sstring := "Added "
|
||||||
|
sstring .= activePID
|
||||||
|
sstring .= " ("
|
||||||
|
sstring .= activeName
|
||||||
|
sstring .= ") to echo list"
|
||||||
|
ShowTooltip(sstring)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveCurrentWindow() {
|
||||||
|
WinGet, activePID, PID, A
|
||||||
|
if (Find(enabledWindows[1], activePID)) {
|
||||||
|
WinGet, activeName, ProcessName, A
|
||||||
|
enabledWindows[1].RemoveAt(Find(enabledWindows[1], activePID))
|
||||||
|
enabledWindows[2].RemoveAt(Find(enabledWindows[2], activeName))
|
||||||
|
sstring := "Removed "
|
||||||
|
sstring .= activePID
|
||||||
|
sstring .= " ("
|
||||||
|
sstring .= activeName
|
||||||
|
sstring .= ") from echo list"
|
||||||
|
ShowTooltip(sstring)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
F3::
|
F3::
|
||||||
@@ -247,16 +270,22 @@ F3::
|
|||||||
return
|
return
|
||||||
|
|
||||||
^!A::
|
^!A::
|
||||||
ShowTooltip("Adding")
|
ShowTooltip("Adding key")
|
||||||
addNext := 1
|
addNext := 1
|
||||||
return
|
return
|
||||||
|
|
||||||
^!S::
|
^!S::
|
||||||
|
ShowTooltip("Adding window")
|
||||||
AddCurrentWindow()
|
AddCurrentWindow()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
^!D::
|
||||||
|
ShowTooltip("Removing window")
|
||||||
|
RemoveCurrentWindow()
|
||||||
|
return
|
||||||
|
|
||||||
^!R::
|
^!R::
|
||||||
ShowTooltip("Removing")
|
ShowTooltip("Removing key")
|
||||||
removeNext := 1
|
removeNext := 1
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user