Thank you @mikeyww for your help.
I hope I'm understanding you correctly. Here are the variable values (it shows this when the script is not working and after I reload the script and it works; it is unchanged):
When the script is not working I see this:
After I reload it and it works, I see this:
This is the script:
Disclosure: I added
I am using this script on a laptop; I'm not using any external displays. There is no change in displays.
This is the only script using this hotkey.
I can post the other scripts here if that would be useful. They're a bit wordy.
I'm not sure if the above is what you were referring to when you said "displaying the values of the variables in the function." I got this info from Autohotkey upon booting up and the script didn't work, and then after I reloaded the script and it worked. Please let me know if other information is needed!
I hope I'm understanding you correctly. Here are the variable values (it shows this when the script is not working and after I reload the script and it works; it is unchanged):
Global Variables (alphabetical)
--------------------------------------------------
0[1 of 3]: 0
A_Args: Object object {address: 0x8427B0}
ErrorLevel[1 of 3]: 0
mon[0 of 0]:
monBottom[4 of 7]: 1034
monHeight[4 of 7]: 1035
monLeft[1 of 3]: 0
monRight[4 of 7]: 1920
monTop[1 of 3]: 0
monWidth[4 of 7]: 1921
When the script is not working I see this:
---- C:\Users\migue\Downloads\apps\AHK scripts_Excludando\center_window_redux.ahk
003: SysGet,mon,MonitorWorkArea
004: monWidth := monRight - monLeft + 1
005: monHeight := monBottom - monTop + 1
011: Return (19.88)
After I reload it and it works, I see this:
---- C:\Users\migue\Downloads\apps\AHK scripts_Excludando\center_window_redux.ahk
003: SysGet,mon,MonitorWorkArea
004: monWidth := monRight - monLeft + 1
005: monHeight := monBottom - monTop + 1
011: Return (10.36)
011: center("A")
014: WinGet,win,List,winTitle
015: Loop,win
016: WinGetPos,,,width,height,wTitle := "ahk_id" win%A_Index%
017: x := monLeft + (monWidth - width) / 2
018: y := monTop + (monHeight - height) / 2+5
019: WinMove,wTitle,,x,y (0.11)
020: }
021: }
011: Return (7.97)
This is the script:
CODE:
#Requires AutoHotkey v1.1.33
Global monLeft, monTop, monWidth, monHeight
SysGet mon, MonitorWorkArea
monWidth := monRight - monLeft + 1
monHeight := monBottom - monTop + 1
; #NoTrayIcon ; comment out if you want to see the tray icon for this script
; Center active window with Windows + \
#\::center("A")
center(winTitle) {
WinGet win, List, % winTitle
Loop % win { ; Loop through all matching windows for this WinTitle
WinGetPos ,,, width, height, % wTitle := "ahk_id" win%A_Index%
x := monLeft + (monWidth - width) / 2
y := monTop + (monHeight - height) / 2+5
WinMove % wTitle,, x, y
}
}
return
Disclosure: I added
this morning because I thought it might help…return
I am using this script on a laptop; I'm not using any external displays. There is no change in displays.
This is the only script using this hotkey.
I can post the other scripts here if that would be useful. They're a bit wordy.
I'm not sure if the above is what you were referring to when you said "displaying the values of the variables in the function." I got this info from Autohotkey upon booting up and the script didn't work, and then after I reloaded the script and it worked. Please let me know if other information is needed!
Statistics: Posted by loopernow — Today, 09:04