It's supposed to toggle between fullscreen and windowed modes of an application when pressing F12, as well as hide the taskbar during the fullscreen mode. I need it to work with a multi-monitor setup. What happens right now is, it just toggles a white border around the active application when I press F12, and It also only has any sort of effect on my main screen. When I try it on an application on my second monitor, the active window disappears from view completely on the second monitor, and the taskbar disappears on the first monitor. Any help would be very appreciated, and thank you in advance.
Code: Select all
#Requires AutoHotkey v2.0
; Toggle between fullscreen and windowed modes when pressing F12 as well as hide the taskbar during the fullscreen mode
F12::{
static windowId := "", winPosX, winPosY, windowWidth, windowHeight, windowState := ""
tempWindowId := WinExist("A")
if (windowId != tempWindowId) {
windowId := tempWindowId
windowState := 0
}
if (windowState != 1) {
WinGetPos &winPosX, &winPosY, &windowWidth, &windowHeight, windowId
WinSetStyle "-0xC40000", windowId
WinMove 0, 0, A_ScreenWidth, A_ScreenHeight, windowId
;Hide Windows Task Bar and Start Button. (Remove the following two lines if you don't want that behaviour)
try WinHide "ahk_class Shell_TrayWnd"
try WinHide "Start ahk_class Button"
} else {
WinSetStyle "+0xC40000", windowId
WinMove winPosX, winPosY, windowWidth, windowHeight, windowId
;Show the task bar again
try WinShow "ahk_class Shell_TrayWnd"
try WinShow "Start ahk_class Button"
}
windowState := !windowState
}