@TIG said
but Rich knows how, and perhaps he can share his example script, or point you/us to someone else's ?
To be clear, my AHK script, is cobbled together from other scripts and is dependent on a particular UI setup in SketchUp. This is a complete hack with a very blunt axe but it works for me.
- Windows only
- SketchUp 2023 (but you can customize for earlier releases)
- Single horizontal Toolbar stack
- Tray on but sized to narrowest width
NOTE: This works on any active window its not limited to SketchUp
Download and install AutoHotkey
Download and unzip this into a folder wherever you want on your system
Resizer.zip
If you double click the ResizeWindows.ahk it will add an icon to your tray so you know when you have it active for use.
The shortcuts keys I've set are:
- Ctrl+F10 1:1 @600px x 600px
- Ctrl+F9 4:3 @800px x 600px
- Ctrl+F8 16:9 @800px x 450px
- Ctrl+F7 21:9 @945px x 405px
- Windows Key + LMB will hide the title bar of active window (Utility)
- Windows Key + RMB will show the title bar of active window (Utility)
- CTRL+ALT+LMB to toggle always on top (Utility)
- CTRL+SHIFT+F8 display a popup with the Width/Height of active window (Utility)
If you open the ResizeWindows.ahk with a text editor you will see the following:
#NoEnv
#SingleInstance, force
#Persistent
SendMode Input
SetWorkingDir %A_ScriptDir%
Menu, Tray, Icon, %A_WorkingDir%\icons\resize.png ,, 1 ; icon
#installKeybdHook
TrayTip, %A_ScriptName%, Started, 1
^+F8:: ; Get window stats to create more presets below
WinGetActiveStats, winT, winW, winH, winX, winY
WinGetClass, class, A
MsgBox,
(
- TITLE
%winT%
- DIMENSIONS
%winW% x %winH%
)
return
^F10::ResizeWin(956,719) ; Ctrl+F10 1:1 @600px x 600px
^F9::ResizeWin(1156,719) ; Ctrl+F9 4:3 @800px x 600px
^F8::ResizeWin(1156,569) ; Ctrl+F8 16:9 @800px x 450px
^F7::ResizeWin(1301,524) ; Ctrl+F7 21:9 @945px x 405px
^!Lbutton:: ; Ctrl+Alt+Lbutton to toggle always on top
WinGet, currentWindow, ID, A
WinGet, ExStyle, ExStyle, ahk_id %currentWindow%
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
{
Winset, AlwaysOnTop, off, ahk_id %currentWindow%
}
else
{
WinSet, AlwaysOnTop, on, ahk_id %currentWindow%
}
return
ResizeWin(Width = 0,Height = 0)
{
WinGetPos,X,Y,W,H,A
If %Width% = 0
Width := W
If %Height% = 0
Height := H
WinMove,A,,%X%,%Y%,%Width%,%Height%
}
;-----------------------------
;Collapse titlebar
LWIN & LButton::
WinSet, Style, -0xC00000, A
return
;Uncollapse titlebar
LWIN & RButton::
WinSet, Style, +0xC00000, A
return
;-----------------------------
Gui, +ToolWindow +AlwaysOnTop -SysMenu -Caption +Border
Gui, Color, cCCCCCC
SetTimer, Draw, 100
Draw:
MouseGetPos, MouseX, MouseY, MouseWin ; get mouse coords/window
WinActivate, %MouseWin%
WinGetActiveStats, Title, WinW, WinH, WinX, WinY ; get the stats of the active window
; variables
DrawW := (WinW)
DrawH := (WinH)
DrawX := (WinX - 1)
DrawY := (WinY - 1)
; show the gui
Gui, Show, NoActivate w%DrawW% h%DrawH% x%DrawX% y%DrawY%, Draw
WinSet, TransColor, CCCCCC, Draw
return
It is lines 24 to 27 that handle the resizing of the SketchUp window. These you may need to tweak to get the result you want. For me it does what I want. I could go into more details but look at this filthy hack length already.