Notifications
Clear all

[Closed] Safe Frames with Custom values Maxscript

Hello All,

I am trying to build a maxscript for turning on safe frames with custom settings.

I am halfway through and need assistance for the following.

My Code for the safe frames is


-- Safe Frames Code
struct setSFStr
(
fn setCheckBoxState hwnd state = 
( 
local BN_CLICKED =0
local BM_SETCHECK = 241
local WM_COMMAND = 273
 
local parent = UIAccessor.getParentWindow hwnd
local id = UIAccessor.getWindowResourceID hwnd
windows.sendMessage hwnd BM_SETCHECK (if state then 1 else 0) 0
windows.sendMessage parent WM_COMMAND ((bit.shift BN_CLICKED 16) + id) hwnd 
ok
 
),
fn getButtonHwnd hnd cbn:"Action Safe" = 
(
for i in (windows.getChildrenHWND hnd) where matchPattern i[5] pattern:cbn do return i[1]
0
),
fn getButtonHwnd2 hnd2 cbn2:"Show Safe Frames in Active View" = 
(
for i in (windows.getChildrenHWND hnd2) where matchPattern i[5] pattern:cbn2 do return i[1]
0
),
fn sfTurnOn = 
(
local hnd = dialogmonitorops.getwindowhandle()
local TCM_SETCURFOCUS = 0x1330
 
for kidHWND in (UIAccessor.GetChildWindows hnd) where ((UIAccessor.GetWindowClassName kidHWND) == "SysTabControl32") do ( UIAccessor.SendMessage kidHWND TCM_SETCURFOCUS 2 0 )
setSFStr.setCheckBoxState (setSFStr.getButtonHwnd hnd) on
setSFStr.setCheckBoxState (setSFStr.getButtonHwnd2 hnd) on
uiaccessor.pressButtonByName hnd "OK"
true
),
 
fn setSF state =
(
DialogMonitorOPS.unRegisterNotification id:#useSF
DialogMonitorOPS.enabled = off
DialogMonitorOPS.enabled = on 
DialogMonitorOPS.RegisterNotification (setSFStr.sfTurnOn) id:#useSF
max vptconfig
DialogMonitorOPS.unRegisterNotification id:#useSF
DialogMonitorOPS.enabled = off
)
)
-- Safe Frames Code End
setSFStr.setSF on 

By this, I am able to turn the “Action Safe” checkbox ON.

Now All I need is,

Uncheck the lock checkbox
Set 25 as Horizontal Percent Reduction Value.

Please assist me in doing that.

Thanks a lot!