AutoHotkey变量不作为坐标发送

时间:2018-08-28 23:00:20

标签: variables coordinates autohotkey

我无法使synatx正常工作,以使GUI在正确的位置显示窗口。它应该显示在x0,y(SciteWindow的坐标),w(显示器宽度),h(显示器高度/ 17)处。我认为Winmove命令中有错误。请查看附带的代码。

#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

1 个答案:

答案 0 :(得分:1)

文档指出您需要具备以下条件之一:

WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
WinMove, X, Y

您有:

Winmove, %SomeStupidBar%,  x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%

请注意缺少WinText。

尝试将其留空:

Winmove, %SomeStupidBar%,, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%