ScriptSpot

Forum topic · Scripts Wanted

Automated Script Dialog

By JokerMartini · 2010-08-05

Downloads
Description

Is there anyway to make a script that will automatically take a folder of macroscripts and create a dialog with buttons corresponding to each script in the folder.
I've found myself running out of hotkeys and tired of remaking dialogs every so often as I accumulate scripts.

Ideally it would be cool if the script would take a selected folder of individual scripts and create a dialog using the name for every script as the button label and the name of the folder as the title of the dialog.

Thoughts??
Thanks
JokerMartini

Comments (3)

JokerMartini · 2010-08-05

Awesome Insanto, thank you for the help!
I'll be sure to check it out and mess with it.

here you go: ( local

Graph · 2010-08-05

here you go:


(
	local directory = "C:\\Program Files\\Autodesk\\3ds Max 2011\\Scripts"
	
	local sFiles = getFiles (directory + "\\*.ms*")

	local rci = rolloutCreator "myRollout" "My Rollout"

	rci.begin()
	
	for file in sFiles do
	(
		local fIndex = findItem sFiles file
		local fbName = "b" + (fIndex as string)
		
		if fIndex / 2.0 != fIndex / 2 then
		(
			rci.addControl #button fbName (getFIleNameFile file) paramStr:"width:80 height:28 align:#left across:2"
			rci.addHandler fbName #pressed filter:on codeStr:("fileIn @" + file + "@")
		)
		else		
		(
			rci.addControl #button fbName (getFIleNameFile file) paramStr:"width:80 height:28 align:#right"
			rci.addHandler fbName #pressed filter:on codeStr:("fileIn @" + file + "@")
		)
	)
	
	local RO = (rci.end())
	createDialog RO
)

feel free to expand on it on your own