#Requires AutoHotkey v2.0 #SingleInstance Force global InterpolationModes := Map( "Nearest neighbor", 0, "Linear", 1, "Cubic", 2, "Linear (multi-sample)", 3, "Anisotropic", 4, "High quality cubic", 5, ) if (A_Args.Length < 1) { MsgBox("Error: Please provide the scaling method parameter.", "Error", 0x10) ExitApp(2) } try { modeA := A_Args[1] modeB := (A_Args.Length == 2) ? A_Args[2] : modeA wParam := CalcWParam(modeA, modeB) } catch Error as err { MsgBox(err.Message, "Error", 0x10) ExitApp(2) } activeHWnd := WinExist("A") if (!activeHWnd) { ExitApp(3) } try { OpusPicViewerHWnd := ControlGetHwnd("dopus.viewpic1", activeHWnd) } catch { OpusPicViewerHWnd := WinExist("ahk_class dopus.viewpic ahk_parent " activeHWnd) if (!OpusPicViewerHWnd) { for ctrlHwnd in WinGetControlsHwnd(activeHWnd) { if (WinGetClass(ctrlHwnd) == "dopus.viewpic") { OpusPicViewerHWnd := ctrlHwnd break } } } } if (!OpusPicViewerHWnd) { ExitApp(3) } WM_APP := 0x8000 msg := WM_APP + 3914 result := SendMessage(msg, wParam, 0, OpusPicViewerHWnd) if(result == 1) { ExitApp(0) } ExitApp(1) CalcWParam(modeZoomIn, modeZoomOut) { modeZoomIn := Trim(modeZoomIn) modeZoomOut := Trim(modeZoomOut) if (!InterpolationModes.Has(modeZoomIn) || !InterpolationModes.Has(modeZoomOut)) { throw Error("Unknown scaling method") } codeZoomIn := InterpolationModes[modeZoomIn] codeZoomOut := InterpolationModes[modeZoomOut] wParam := (codeZoomOut << 12) + (codeZoomIn << 8) + 0x01 return wParam }