Hi.
Someone provided me with a script to toggle foobar2000 into fullscreen display.
When I got the script it had Ctrl+Alt+Shift+G {^!+g} as the hotkey which I changed to F9.
This worked, but changing from F9 to F11 won't work.
Any help would be very much appreciated.
Below the script and thanks in advance.
Someone provided me with a script to toggle foobar2000 into fullscreen display.
When I got the script it had Ctrl+Alt+Shift+G {^!+g} as the hotkey which I changed to F9.
HotKeySet("{F9}", "ToggleFullscreen")
This worked, but changing from F9 to F11 won't work.
Any help would be very much appreciated.
Below the script and thanks in advance.
[ autoit ]
#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=foobar.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Run_Tidy=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include ; ============================================================================ ; ; Changing this to True will make the script start foobar200 itself, and exit when it closes. ; Otherwise the script will stay running indefinitely, monitoring for foobar2000 whenever it starts. Global Const $startFoobar2000 = True Global $pidFoobar2000 = 0 Global $wndFoobar2000 = 0 Global $wndSavedPosition Global Const $FullscreenRect[2] = [ _ _WinAPI_GetSystemMetrics($SM_CXSCREEN), _ _WinAPI_GetSystemMetrics($SM_CYSCREEN) _ ] Func ToggleFullscreen() Global $wndFoobar2000, $wndSavedPosition Local Const $stylesToRemove = BitOR($WS_CAPTION, $WS_BORDER, $WS_SIZEBOX) If Not WinExists($wndFoobar2000) Then Return Local $wndStyle = _WinAPI_GetWindowLong($wndFoobar2000, $GWL_STYLE) If @error Then Return If BitAND($wndStyle, $stylesToRemove) <> 0 Then $wndSavedPosition = WinGetPos($wndFoobar2000) $wndStyle = BitAND($wndStyle, BitNOT($stylesToRemove)) _WinAPI_SetWindowLong($wndFoobar2000, $GWL_STYLE, $wndStyle) _WinAPI_SetWindowPos($wndFoobar2000, $HWND_TOPMOST, _ 0, 0, _ 0, 0, _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) _WinAPI_SetWindowPos($wndFoobar2000, 0, _ 0, 0, _ $FullscreenRect[0], $FullscreenRect[1], _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOZORDER)) Else $wndStyle = BitOR($wndStyle, $stylesToRemove) _WinAPI_SetWindowLong($wndFoobar2000, $GWL_STYLE, $wndStyle) _WinAPI_SetWindowPos($wndFoobar2000, $HWND_NOTOPMOST, _ 0, 0, _ 0, 0, _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) If UBound($wndSavedPosition, 1) >= 4 Then _WinAPI_SetWindowPos($wndFoobar2000, 0, _ $wndSavedPosition[0], $wndSavedPosition[1], _ $wndSavedPosition[2], $wndSavedPosition[3], _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOZORDER)) EndIf EndIf EndFunc ;==>ToggleFullscreen Func GetFoobar2000Window() Local $allWindows = _WinAPI_EnumWindowsTop() If @error Then Return 0 Local $wndAlt = 0 For $i = 1 To $allWindows[0][0] Local $hwnd = $allWindows[$i][0], $pidWindow If _WinAPI_GetWindowThreadProcessId($hwnd, $pidWindow) And $pidWindow == $pidFoobar2000 Then ; This is a hackish way to try and detect foobar2000's main window. ; It should have a maximize button, or at least the corresponding style! If (BitAND(_WinAPI_GetWindowLong($hwnd, $GWL_STYLE), $WS_MAXIMIZEBOX)) Then Return $hwnd ElseIf Not $wndAlt And StringInStr(_WinAPI_GetWindowText($hwnd), "foobar2000") Then $wndAlt = $hwnd EndIf EndIf Next ; No window found with the semi-reliable method. Just return one with 'foobar2000' in the title. Return $wndAlt EndFunc ;==>GetFoobar2000Window If $startFoobar2000 Then $pidFoobar2000 = Run(StringFormat('"%s/%s" %s', @ScriptDir, "foobar2000.exe", _Iif(@Compiled, $CmdLineRaw, ""))) If @error Then MsgBox($MB_ICONHAND, "foobar2000 Full-screen", "Error: failed to start foobar2000.exe. Make sure this script is placed in foobar2000's folder.") Exit 1 EndIf If _Singleton("foobar2000_fullscreen", 1) == 0 Then Exit 1 EndIf ElseIf _Singleton("foobar2000_fullscreen", 1) == 0 Then Exit 1 EndIf HotKeySet("{F9}", "ToggleFullscreen") While True If Not ProcessExists($pidFoobar2000) Then If Not $startFoobar2000 Then $pidFoobar2000 = ProcessWait("foobar2000.exe") Else Exit EndIf EndIf If Not WinExists($wndFoobar2000) Then $wndFoobar2000 = GetFoobar2000Window() If Not $wndFoobar2000 Then Sleep(1000) ContinueLoop EndIf EndIf Sleep(200) WEnd