script to ui installer

hello!
i have so many useful scripts by now, but no way of accesing them instantaneously,
is there an easy way to access my scripts on startup of max through the customize UI section, i know macroscripts can do this, but theres many scripts i have that arent macroscript, i just want to add them to my toolbar?!

any help would be greatly appreciated!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
W DIGITAL's picture

files = getFiles ((getDir

files = getFiles ((getDir #scripts) + "\\test\\*.ms")
if files.count != 0 then
(
for f = 1 to files.count do
templist[f] = getFilenameFile files[f]
for f in files do fname = FilenameFromPath f
)
outputName = getSaveFileName caption:"Save MaxScript File" \
types:"Script Files (*.mcr)|*.mcr|All Files (*.*)|*.*|"
if outputName != undefined then
(
outputFile = CreateFile outputName
for f = 1 to files.count do
(
str = "macroScript new" + (f as string) + " "
str += "category:\"test\" tooltip:\""
str += templist[f] + "\" buttonText:\"" + templist[f] + "\"\n"
str += "(\n" + "setCommandPanelTaskMode #create\n"
str += "on execute do\n" + "(\n"
str += "filein \"" + files[f] + "\"\n" + ")\n" + ")\n"
format "%" str to:outputFile
)
close outputFile
edit outputName
)

this code i execute, but saving the file does not produce a fiel for me :)

im frustrated

Anubis's picture

-- Fix: replace this

-- Fix: replace this line:
str = "macroScript " + uniquename "new" + " "
-- with this:
str = "macroScript new" + (f as string) + " "
-- If you work with "test" folder, change and 1st line to:
files = getFiles ((getDir #scripts) + "\\test\\*.ms")

I make a test with 3 files (test01.ms, test02.ms, test03.ms) in folder "test" to see the saved script result:

macroScript new1 category:"phizikl" tooltip:"test01" buttonText:"test01"
(
setCommandPanelTaskMode #create
on execute do
(
filein "C:\Program Files\Autodesk\3ds Max 2009\scripts\test\test01.ms"
)
)
macroScript new2 category:"phizikl" tooltip:"test02" buttonText:"test02"
(
setCommandPanelTaskMode #create
on execute do
(
filein "C:\Program Files\Autodesk\3ds Max 2009\scripts\test\test02.ms"
)
)
macroScript new3 category:"phizikl" tooltip:"test03" buttonText:"test03"
(
setCommandPanelTaskMode #create
on execute do
(
filein "C:\Program Files\Autodesk\3ds Max 2009\scripts\test\test03.ms"
)
)

Maybe I did not understand correctly, yes, if folder not exist and not files in it - nothing happens. And... Did you change penultimate line as I said above?
Here's how:
Old last 3 lines:

	close outputFile
	edit outputName
)

New last 3 lines:

	close outputFile
)
edit outputName

my recent MAXScripts RSS (archive here)

W DIGITAL's picture

jes it doenst increment, but

jes it doenst increment, but i dont even have the output file,
so for me thers no new category, and no .mcr file

W DIGITAL's picture

all i did was change the

all i did was change the folder name to parentize, thats where i have 4 scripts sitting (Scripts/parentize/*.ms, which should be "installed" and available in parentize category,
but no category exists, and no file is saved, :(

files = getFiles ((getDir #scripts) + "\\parentize\\*.ms")
if files.count != 0 then
(
for f = 1 to files.count do
templist[f] = getFilenameFile files[f]
for f in files do fname = FilenameFromPath f
)
outputName = getSaveFileName caption:"Save MaxScript File" \
types:"Script Files (*.mcr)|*.mcr|All Files (*.*)|*.*|"
if outputName != undefined then
(
outputFile = CreateFile outputName
for f = 1 to files.count do
(
str = "macroScript " + uniquename "new" + " "
str += "category:\"parentize\" tooltip:\""
str += templist[f] + "\" buttonText:\"" + templist[f] + "\"\n"
str += "(\n" + "setCommandPanelTaskMode #create\n"
str += "on execute do\n" + "(\n"
str += "filein \"" + files[f] + "\"\n" + ")\n" + ")\n"
format "%" str to:outputFile
)
close outputFile
edit outputName
)

Anubis's picture

Well, I not add any comments

Well, I not add any comments :) so... following your request I think you want to use "scripts\phiZikl" directory; and save dialog need for new file creating to select dir and file name. I tested it several times and it's works fine. New created .MCR file contain exactly what you need.

Add this line at the end of file:

edit outputName

If all OK (and must be) then created file will be loaded in MaxScript editor.

And Yes, increment come after "new" but... ops... I see a bugg :( , all macroscripts come with the same "new01" instead of new01, new02, ...

my recent MAXScripts RSS (archive here)

W DIGITAL's picture

ok i just tried it but i

ok i just tried it but i cant get it work,
what do i save file for? where do i put it?

i put 4 scripts as an example into folder /test/

(renamed phizikl in cod to test)

then i run script, it asks me to save .mcr , i save it,

but no file is saved, also is this line str = "macroScript " + uniquename "new" + " "
no number or increment come after new?

sorry i cannot run it :(

forgive my stupidity!

Anubis's picture

files = getFiles ((getDir

files = getFiles ((getDir #scripts) + "\\phiZikl\\*.ms")
if files.count != 0 then
(
	for f = 1 to files.count do
		templist[f] = getFilenameFile files[f]
	for f in files do fname = FilenameFromPath f
)
outputName = getSaveFileName caption:"Save MaxScript File" \
types:"Script Files (*.mcr)|*.mcr|All Files (*.*)|*.*|"
if outputName != undefined then
(
	outputFile = CreateFile outputName
	for f = 1 to files.count do
	(
		str = "macroScript " + uniquename "new" + " "
		str += "category:\"phizikl\" tooltip:\""
		str += templist[f] + "\" buttonText:\"" + templist[f] + "\"\n"
		str += "(\n" + "setCommandPanelTaskMode #create\n"
		str += "on execute do\n" + "(\n"
		str += "filein \"" + files[f] + "\"\n" + ")\n" + ")\n"
		format "%" str to:outputFile
	)
	close outputFile
	edit outputName
)

my recent MAXScripts RSS (archive here)

W DIGITAL's picture

oh my god i love you

oh my god i love you anubis!!!!!

sorry for 2nd post, i thought more people would see it!

THANKSYOU!!!

how can i make it up to you?

i make you a nice graphic or a hot coffeee? ^_^

do you want ANUBIS in 3D with abstract graphix as wallpaper?? :)

W DIGITAL's picture

ok, i have actually found

ok, i have actually found the code to do what i want, but how to automate it so i dont have to typ in every scriptname individually?

macroScript new01 category:"phizikl" tooltip:"Animate It" buttonText:"at"
(
setCommandPanelTaskMode #create
on execute do
(
filein ((getDir #maxroot)+"\\scripts\\phiZikl\\Animation_Timer_v1.8.ms")
)
)

macroScript new02 category:"phizikl" tooltip:"Crack It" buttonText:"ci"
(
setCommandPanelTaskMode #create
on execute do
(
filein ((getDir #maxroot)+"\\scripts\\phiZikl\\crack_it_.ms")
)
)

it would have to get the tooltipo from the filename, and automatically get the scrips from the folder...

i dont think this should be too hard if you know how to code :)

thanks for your help!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.