用 GUI 覆盖 inactive windows,可变坐标解 (AHK)
Cover inactive windows with GUI, Solutions to Variable Coordinates (AHK)
我在不活动时将所有 windows 折叠到标题栏。我想用不同颜色的 GUI 覆盖这些不活动的 windows。 GUI 只需要最少的功能,只是一种在折叠和不活动时 color-code 标题栏的方法。这样,当我看到满是标题栏的桌面时,我就能更容易地分辨出什么是什么。
虽然我知道我将正确的坐标存储为变量,但如果我将坐标指定为数字或变量,则 gui 根本不会显示。但是如果我不指定任何坐标,GUI 就会出现在屏幕中间。
这似乎是
的组合
-settimer,以及一个在 window 移动时更新坐标的计时器。
-alwaysontop(ish) 每个 gui 的特定 window(可以在这里使用一些帮助,当它关联 window 不活动时,希望应用 winset,top 到 GUI,但也保留在任何新激活的 window 下(以在查看桌面时保持 GUI 可见)。
-使用相应的 window 的 y 坐标来知道放置 GUI 的高度(主要问题,虽然我知道我将正确的坐标存储为变量)
-为每个 GUI 显示不同的颜色。
-GUI 应该跨越整个屏幕宽度,并且是屏幕高度的 1/17(大约是我 screen/resolution 标题栏的高度)。
-在 window 关联的 window 处于活动状态时隐藏 window 的 gui,在不活动时隐藏
#SingleInstance,Force
WinGetPos , X_SciTEWindow, Y_SciTEWindow, Width_SciTEWindow, Height_SciTEWindow, ahk_class SciTEWindow ;I don't even need the X_SciTEWindow, because the bars will all be aligned at x0, but it's there...
SysGet, aScreenHeight, 1
bar_height := Round(aScreenHeight / 17)
Gui, Color, aqua,FFB1B1
Gui, Show, w%A_ScreenWidth% h%bar_height%, SomeStupidBar
WinSet, Style, -20xC40000
Winmove, %SomeStupidBar%, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
MsgBox, Time to move the window to x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
Winmove, %SomeStupidBar%, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
return
Esc::ExitApp
SetTimer, ShowGui, 500
ShowGui:
IfWinNotExist, ahk_class AutohotkeyGUI
{
Gui, +Owner%WinID% +Border +ToolWindow
Gui, Show, NoActivate x%X% y%Y% w51 h431, %GuiTitle%
}
else
{
WinWaitActive, ahk_class SciTEWindow
WinGetPos, X_SciTEWindow, Y_SciTEWindow,,, ahk_class Notepad
WinGet, WinID, ID, ahk_class SciTEWindow,,,
IfWinNotExist, ahk_class AutohotkeyGUI
WinGetPos, %SomeStupidBar%, , , , ahk_class AutohotkeyGUI
If %SomeStupidBar%<>X - 56
WinMove, ahk_class AutohotkeyGUI, X - 56
}
return
如有任何帮助,我们将不胜感激。
#NoEnv
#SingleInstance Force
Gui, SciTE: +Owner -Caption
Gui, SciTE: Color, aqua
Gui, Notepad: +Owner -Caption
Gui, Notepad: Color, red
SysGet, aScreenHeight, 1
bar_height := Round(aScreenHeight / 17)
SetTimer, ShowGui, 500
return
Esc::ExitApp
ShowGui:
If !WinExist("ahk_class SciTEWindow") ; means "NOT"
Gui, SciTE: Cancel
else
{
WinGetPos, X_SciTE, Y_SciTE,,, ahk_class SciTEWindow
If X_SciTE >= 0
Gui, SciTE: Show, NoActivate x%X_SciTE% y%Y_SciTE% w51 h%bar_height%, SciTEWindow
}
If !WinExist("ahk_class Notepad")
Gui, Notepad: Cancel
else
{
WinGetPos, X_Notepad, Y_Notepad,,, ahk_class Notepad
If X_Notepad >= 0
Gui, Notepad: Show, NoActivate x%X_Notepad% y%Y_Notepad% w51 h%bar_height%, Notepad
}
return
#If WinActive("ahk_class AutoHotkeyGUI")
~*LButton Up::
WinGetTitle, ActiveTitle, A
WinActivate, ahk_class %ActiveTitle%
return
#If
我在不活动时将所有 windows 折叠到标题栏。我想用不同颜色的 GUI 覆盖这些不活动的 windows。 GUI 只需要最少的功能,只是一种在折叠和不活动时 color-code 标题栏的方法。这样,当我看到满是标题栏的桌面时,我就能更容易地分辨出什么是什么。
虽然我知道我将正确的坐标存储为变量,但如果我将坐标指定为数字或变量,则 gui 根本不会显示。但是如果我不指定任何坐标,GUI 就会出现在屏幕中间。
这似乎是
的组合-settimer,以及一个在 window 移动时更新坐标的计时器。
-alwaysontop(ish) 每个 gui 的特定 window(可以在这里使用一些帮助,当它关联 window 不活动时,希望应用 winset,top 到 GUI,但也保留在任何新激活的 window 下(以在查看桌面时保持 GUI 可见)。
-使用相应的 window 的 y 坐标来知道放置 GUI 的高度(主要问题,虽然我知道我将正确的坐标存储为变量)
-为每个 GUI 显示不同的颜色。
-GUI 应该跨越整个屏幕宽度,并且是屏幕高度的 1/17(大约是我 screen/resolution 标题栏的高度)。
-在 window 关联的 window 处于活动状态时隐藏 window 的 gui,在不活动时隐藏
#SingleInstance,Force
WinGetPos , X_SciTEWindow, Y_SciTEWindow, Width_SciTEWindow, Height_SciTEWindow, ahk_class SciTEWindow ;I don't even need the X_SciTEWindow, because the bars will all be aligned at x0, but it's there...
SysGet, aScreenHeight, 1
bar_height := Round(aScreenHeight / 17)
Gui, Color, aqua,FFB1B1
Gui, Show, w%A_ScreenWidth% h%bar_height%, SomeStupidBar
WinSet, Style, -20xC40000
Winmove, %SomeStupidBar%, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
MsgBox, Time to move the window to x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
Winmove, %SomeStupidBar%, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
return
Esc::ExitApp
SetTimer, ShowGui, 500
ShowGui:
IfWinNotExist, ahk_class AutohotkeyGUI
{
Gui, +Owner%WinID% +Border +ToolWindow
Gui, Show, NoActivate x%X% y%Y% w51 h431, %GuiTitle%
}
else
{
WinWaitActive, ahk_class SciTEWindow
WinGetPos, X_SciTEWindow, Y_SciTEWindow,,, ahk_class Notepad
WinGet, WinID, ID, ahk_class SciTEWindow,,,
IfWinNotExist, ahk_class AutohotkeyGUI
WinGetPos, %SomeStupidBar%, , , , ahk_class AutohotkeyGUI
If %SomeStupidBar%<>X - 56
WinMove, ahk_class AutohotkeyGUI, X - 56
}
return
如有任何帮助,我们将不胜感激。
#NoEnv
#SingleInstance Force
Gui, SciTE: +Owner -Caption
Gui, SciTE: Color, aqua
Gui, Notepad: +Owner -Caption
Gui, Notepad: Color, red
SysGet, aScreenHeight, 1
bar_height := Round(aScreenHeight / 17)
SetTimer, ShowGui, 500
return
Esc::ExitApp
ShowGui:
If !WinExist("ahk_class SciTEWindow") ; means "NOT"
Gui, SciTE: Cancel
else
{
WinGetPos, X_SciTE, Y_SciTE,,, ahk_class SciTEWindow
If X_SciTE >= 0
Gui, SciTE: Show, NoActivate x%X_SciTE% y%Y_SciTE% w51 h%bar_height%, SciTEWindow
}
If !WinExist("ahk_class Notepad")
Gui, Notepad: Cancel
else
{
WinGetPos, X_Notepad, Y_Notepad,,, ahk_class Notepad
If X_Notepad >= 0
Gui, Notepad: Show, NoActivate x%X_Notepad% y%Y_Notepad% w51 h%bar_height%, Notepad
}
return
#If WinActive("ahk_class AutoHotkeyGUI")
~*LButton Up::
WinGetTitle, ActiveTitle, A
WinActivate, ahk_class %ActiveTitle%
return
#If