ScriptSpot

Forum topic · General Scripting

Maxscript access to free Glue utility plugin.

By Despondo · 2017-07-13

Description

Hello all,

I am attempting to script access to iToosoft's free Glue utility plugin.

https://www.itoosoft.com/freeplugins/glue.php

I've managed to gain access to child objects of the utility via the following commands and assign them as variables, but cannot seem to populate the Base Object field, or have maxscript assign an object as the Base Object without user interaction. Anyone have ideas on how to do this? I followed an example here (http://forums.cgsociety.org/archive/index.php?t-735390.html), but it only required a push of the button on the utility and not selection of an object.


UtilityPanel.OpenUtility glue
children = windows.getChildrenHWND (windows.getDesktopHWND())
pickBaseButton = (for c in children where ( c[5] == "Pick" ) collect ( c ))[1]
pickBase = (for c in children where ( c[4] == "Edit" and c[5] == "" ) collect ( c ))[1]
glueSelButton = (for c in children where ( c[5] == "Glue Selected" ) collect ( c ))[1]
UIAccessor.pressButton pickBaseButton[1]
pickBase[5] = "_Surface_Main"

Comments (2)

Despondo · 2017-07-14

Thanks...I'll give that a try.

`

pixamoon · 2017-07-14

Hi,

Try to use "pick by name" and DialogMonitorOPS to press Default Button:


UtilityPanel.OpenUtility glue
children = windows.getChildrenHWND (windows.getDesktopHWND())
pickBaseButton = (for c in children where ( c[5] == "Pick" ) collect ( c ))[1]
pickBase = (for c in children where ( c[4] == "Edit" and c[5] == "" ) collect ( c ))[1]
glueSelButton = (for c in children where ( c[5] == "Glue Selected" ) collect ( c ))[1]
UIAccessor.pressButton pickBaseButton[1]

----------------------------------------------------------------------
	
obj = $plane001
	
tmpSelection = deepcopy (selection as array)
select obj

fn PressDefault = (UIAccessor.PressDefaultButton(); true)
	
DialogMonitorOPS.unRegisterNotification id: #PressDefaultID
DialogMonitorOPS.RegisterNotification PressDefault id: #PressDefaultID
DialogMonitorOPS.Enabled = true

-- Simulate: Open dialog "Select by Name"
-- When picked button pressed it will work as Pick by Name
actionMan.executeAction 0 "50029"
	
select tmpSelection

DialogMonitorOPS.unRegisterNotification id:#PressDefaultID
DialogMonitorOPS.Enabled = false

Hope it helps,

Best,
Pixamoon