Last active
January 25, 2016 15:52
-
-
Save atnbueno/bbf2c975b0460ac40b66 to your computer and use it in GitHub Desktop.
A simple AutoHotkey script to resize an OpenSCAD window in order to get a 1280x720 viewport
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; AutoHotkey Version: AutoHotkey 1.1 (Unicode x86) | |
; Language: English | |
; Platform: Win7 SP1 | |
; Author: Antonio Bueno <user atnbueno at Google's free e-mail service> | |
; Description: Win+R resizes an OpenSCAD window in order to get a 1280x720 viewport | |
; Last Mod: 2016-01-25 | |
; The desired viewport dimensions | |
nNewWidth := 1280 | |
nNewHeight := 720 | |
; context sensitive hotkey begins | |
#IfWinActive, ahk_exe openscad.exe ahk_class Qt5QWindowIcon | |
#r:: | |
; Get current window dimensions | |
WinGetPos, , , nWindowWidth, nWindowHeight | |
sMessage := "Window size was " nWindowWidth "x" nWindowHeight "`n" | |
; Get current viewport dimensions | |
ControlGetPos, , , nViewportWidth, nViewportHeight, % "Qt5QWindowOwnDCIcon1" | |
sMessage .= "Viewport size was " nViewportWidth "x" nViewportHeight "`n" | |
; Change window dimensions | |
WinMove, , , , , nWindowWidth+nNewWidth-nViewportWidth, nWindowHeight+nNewHeight-nViewportHeight | |
; Get window new dimensions | |
WinGetPos, , , nWindowWidth, nWindowHeight | |
sMessage .= "Window size is now " nWindowWidth "x" nWindowHeight "`n" | |
; Get viewport new dimensions | |
ControlGetPos, , , nViewportWidth, nViewportHeight, % "Qt5QWindowOwnDCIcon1" | |
sMessage .= "Viewport size is now " nViewportWidth "x" nViewportHeight | |
; Feedback to the user | |
TrayTip, % "OpenSCAD viewport resize", % sMessage | |
Return | |
#IfWinActive ; context sensitive hotkey ends |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment