Reputation: 23
I'm having trouble getting the synatx to work properly, to have the GUI show the window in the correct spot. It should show up at x0, y(coordinate of SciteWindow), w(monitor width), h(monitor height/17). I think there are errors in my Winmove command. Please see attatched code.
#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
Upvotes: 2
Views: 236
Reputation: 93
The documentation states that you need to have one of the following:
WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
WinMove, X, Y
You have:
Winmove, %SomeStupidBar%, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
Notice the missing WinText.
Try leaving it blank:
Winmove, %SomeStupidBar%,, x0, y%Y_SciTEWindow%, w%A_ScreenWidth%, h%bar_height%
Upvotes: 1