ScriptSpot

Forum topic · Scripts Wanted

script to ui installer

By W DIGITAL · 2009-04-30

Description

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 (29)

MyScript

othoap · 2011-05-01

Hi,

111_SmartMenu_v.0.1 by Andrei Kletskov puts a category selection in the menu bar called "MyScrips." Any script that's placed in the folder of choice is listed under the "MyScrips" menu.

W DIGITAL · 2010-10-03

hi crystal, i have released it as the Macrotize script, you can use it now witout problems!

crystal3d · 2011-04-30

great! will give it a GO, sure it will be fine

crystal3d · 2010-08-23

so this script allows me to run "*.ms " scripts from UI, ver nice but can someoe wrap it up together the correct code and some notes about where to put the ms. would be cool.

cheers

Anubis · 2009-10-05

I just reply on your last email, but if not received it yet, there you go - add this line at the beginning of the code:

templist = #() --define empty array

W DIGITAL · 2009-10-05

ok i i ran script and listenere
here is the error:

#("C:\Program Files\Autodesk\3ds Max 2009\\scripts\phizikl\Macrofy.ms", "C:\Program Files\Autodesk\3ds Max 2009\\scripts\phizikl\mesh_snowmaker.ms", "C:\Program Files\Autodesk\3ds Max 2009\\scripts\phizikl\Pinscreen.ms", "C:\Program Files\Autodesk\3ds Max 2009\\scripts\phizikl\Speed_Circular_Array.ms")
-- Error occurred in f loop; filename: R:\SOFTWARE\3D Software\3DSMax\3DSMAX Scripts\phiZikl\phiZikl\Macrofy.ms; position: 166
-- Frame:
-- templist: undefined
-- f: 1
-- called in anonymous codeblock
-- Frame:
-- No ""put"" function for undefined
"C:\Documents and Settings\phiZikl\Desktop\test.mcr"
-- Error occurred in f loop; filename: R:\SOFTWARE\3D Software\3DSMax\3DSMAX Scripts\phiZikl\phiZikl\Macrofy.ms; position: 581
-- Frame:
-- templist: undefined
-- str: "macroScript new1 category:"phizikl" tooltip:""
-- f: 1
-- called in anonymous codeblock
-- Frame:
-- outputfile:
-- No ""get"" function for undefined
OK

W DIGITAL · 2009-10-05

hi anubis, i hae tried it yet again, as soon as i have .ms files in the test directory, it gives me error

---------------------------
MAXScript FileIn Exception
---------------------------
-- No ""put"" function for undefined
---------------------------
OK
---------------------------

templist[f] = getFilenameFile files[f]

anyway you can help, i would really like to make this script work, :( thanks

btw i have skype:phizikl

Anubis · 2009-09-17

Ok, do one test. edit this line:

format "%" str to:outputFile

and delete or hide "to:outputFile", ie:

format "%" str --to:outputFile

this way the generated string will be prined to Listener.
Be sure so you clean all text in Listener before evaluating the script (so in Listener press Ctrl+D) and then in MXS Editor Cltr+E. Now form Listener you can save the code as .MS file.

So, do this test and say if this works.

W DIGITAL · 2009-09-17

yes, i work under administrative account,

it still doesnst work, can you make other code that works?

Anubis · 2009-08-04

Because I think that some antivirus programs treat files with extensions .MS and .MCR as high-risk files and you say so nothing go out to file, so what comes to my mind is to ask whether you work under administrative account?

W DIGITAL · 2009-08-03

hi anubis,
i have tried the script but it deosnt save a file for me ?
please help

W DIGITAL · 2009-05-04

jes if undefined nothing happens, but of course i write a name, and at least it does save the test file! but with nothing in it,
does it matter where the macrocomposer.ms is sitting, lets say on the desktop or in scripts folder?

Anubis · 2009-05-03

if outputName != undefined then
is used to check is save dialog confirmed or canceled, so if you cancel no file saved. but why for you save empty file?... that's strange.

W DIGITAL · 2009-05-02

i also try it on computer here in office, doesnt work :(

i have a question

if outputName != undefined then

does it only create macro if output name undefined?

because it asks to save maxscript you have to enter name, which means, you define it ? so thats why the macro is empty?

i have tried putting the script even in scripts folder but doesnt change,

i get a macro file, but it is empty...

Anubis · 2009-05-01

((getDir #maxroot)+"\\scripts") = (getDir #scripts) ie they are return the same path. I'm to using max2009 x64 and realy have no idea why the script dont work for you ?!

W DIGITAL · 2009-05-01

str += "filein \"" + files[f] + "\"\n" + ")\n" + ")\n"

isthis the problem is it whee the maxroot is missing?

W DIGITAL · 2009-05-01

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

***this code creates a file for me,***

files = getFiles ((getDir #maxroot)+"\\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:\"aa"
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 doesnt,

thats so weird (tried with maxroot as well, im using max2009 64bit

W DIGITAL · 2009-05-01

strange :)

i know your code works something with directory problem
my directory is
C:\Program Files\Autodesk\3ds Max 2009\Scripts\test

( i also try it with phiZikl folder which has 20scripts, and my "manual" code works for that)

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

maybe thats the problem?

MAXROOT is missing?

W DIGITAL · 2009-05-01

ijes i changed the last line now,

now it creates a macro file!

only it is empty :)

under Scripts/test/ i have two files now test.ms and rest.ms just for example,

it produces file but no code inside,
weird

Anubis · 2009-05-01

There is the file attached

Attachments

W DIGITAL · 2009-05-01

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

-- Fix: replace this

Anubis · 2009-05-01

-- 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

W DIGITAL · 2009-05-01

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 · 2009-05-01

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 · 2009-05-01

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, ...

W DIGITAL · 2009-05-01

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!

files = getFiles ((getDir

Anubis · 2009-05-01

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
)

W DIGITAL · 2009-05-01

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 · 2009-05-01

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!