Notifications
Clear all

[Closed] Missing classes in popup

How to make script to show missing plugins(classes) in messageBox.
I stuck on this one. I was trying with my code but it won’t work so maybe it way to create new one.

6 Replies

Go here and use “removeMissingPlugins v0.1 beta” to solve your problems.

Thx however I don’t want to remove missing plugins, I creating tool and I need info about missing plugins in popup, is it posibile to do this?

The script collects all missing plugins and removes them. So, delete the part of the code, that removes the missing plugins and use the collected missing plugins to show them in a messagebox. In fact the script will show all missing plugins in a messagebox.

thanks, it was to obvious to figure this out. It works. Thanks, You save me problem number xxxx now i have to solve only another xxx:)

struct MissingData (class, name, instances = #())
fn getMissingClasses =
(
	ss = stringstream "" 
	apropos "*missing*" to:ss
	seek ss 0
	missed = #()
	while not eof ss and iskindof (st = readline ss) String do
		if (findstring st "(const MAXClass)" != undefined) do append missed \
		(
			stt = filterstring st ": "
			MissingData name:stt[stt.count]
		) 
	missed
)
fn getMissingInstances =
(
	data = getMissingClasses()
	for d in data do
	(
		if iskindof (d.class = execute d.name) MAXWrapper do d.instances = getclassinstances d.class
	)
	data
)

here is a basic functions we need. (probably go with link above you will see something similar)

no the functions need a cool wrapper… let me try to make it

here is it…

try(destroydialog missingThingsInspector) catch()
rollout missingThingsInspector "Find Missing Things with denisT" width:240
(
	struct MissingData (class, name, instances = #())
	fn getMissingClasses =
	(
		ss = stringstream "" 
		apropos "*missing*" to:ss
		seek ss 0
		missed = #()
		while not eof ss and iskindof (st = readline ss) String do
			if (findstring st "(const MAXClass)" != undefined) do append missed \
			(
				stt = filterstring st ": "
				MissingData name:stt[stt.count]
			) 
		missed
	)
	fn getMissingInstances =
	(
		data = getMissingClasses()
		for d in data do
		(
			if iskindof (d.class = execute d.name) MAXWrapper do d.instances = getclassinstances d.class
		)
		data
	)

	dotnetcontrol tv "TreeView" pos:[4,4] width:232 height:390
	
	button search_bt "Find Missing" width:232 align:#right offset:[9,0]
	
	fn dotcolor c darker:0.5 = (dotnetclass "System.Drawing.Color").FromArgb (c.r*darker) (c.g*darker) (c.b*darker) 
	on search_bt pressed do
	(
		tv.BeginUpdate()
		tv.Sorted = true
		tv.nodes.clear()
		treenode = dotnetclass "TreeNode"
		data = getMissingInstances()
		nodes = for d in data collect
		(
			node = dotnetobject treenode d.name
			node.tag = dotnetmxsvalue d.class
			maxOps.colorById (gethashvalue d.name 0) &c
			node.forecolor = dotcolor c
			items = for node in d.instances collect
			(
				item = dotnetobject treenode node.name
				item.tag = dotnetmxsvalue node
				maxOps.colorById (gethashvalue (getclassname node) 0) &c
				item.forecolor = dotcolor c
				item
			)
			node.nodes.AddRange items
			node
		)
		tv.nodes.AddRange nodes
	
		tv.EndUpdate()
	)
)
createdialog missingThingsInspector

ok… the morning warm-up is over… i go to work now.