Calling multiple scripts

Calling multiple scripts

Anonymous
Not applicable
623 Views
4 Replies
Message 1 of 5

Calling multiple scripts

Anonymous
Not applicable
What I am trying to do is create one script that will create a rollout with buttons that will call each of the scripts I have written. In other words I would like to put all of my scripts in one location, then have the main calling script look in that location, find all the maxscript files, then dynamically create a rollout based on how many scripts it found. Below is the code I have so far.

--------------------------------------------------------------------

scriptFiles = getFiles "Z:\Programming Files\MaxScript\*.ms"

rollout scriptBox "ScriptBox"
(
for script in scriptFiles do
(
fileName = getFilenameFile script

button fileName fileName width:80 height:20 align:#center

on fileName pressed do
(
fileIn script
)
)

)
createDialog scriptBox 90 60

--------------------------------------------------------------------

I have written a similar script in MEL and it works fine. However in maxscript I keep getting the following error: error at for, expected <rollout clause>. Does anyone know what is wrong?
0 Likes
624 Views
4 Replies
Replies (4)
Message 2 of 5

Steve_Curley
Mentor
Mentor
As the error message implies, then only statements allowable within a Rollout block are "rollout clauses". Quite how you're supposed to add an indeterminate number of buttons I'm not sure. I'll have a play, but hopefully one of the local gurus will notice the thread and reply.

2 quick points.
If you post code, put it in "" "" tags (without the spaces, of course) - much easier to read
In the getFiles line all the backslashes must be doubled i.e. “Z:\\Programming Files\\MaxScript\\*.ms”

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 5

Anonymous
Not applicable
check out smart menu from http://andklv2.narod.ru/maxscripts/ak-maxscripts.html for a simple option.. or try AeronSetup from http://forums.cgsociety.org/showthread.php?t=293684 for something a little more complex but a little more customizable.
0 Likes
Message 4 of 5

Anonymous
Not applicable
-dbuchhofer
Thanks for the links. The code I found there helped me out a lot.

-Steve
Thanks for the tip about the code tags. I will remember to do that next time. However your advice about the backslashes is incorrect. Single backslashes will work just fine for the getFiles command.
0 Likes
Message 5 of 5

Steve_Curley
Mentor
Mentor
That command is an exception then - there are many threads littered around here containing code (fragments) which don't work due to missing "\\". Even the example in the help for getFiles uses them. If it works with either then probably better to use both - for consistency if nothing else.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes