Hi!
this is one of my favorite scripts, or was, since it crashes my Max 2014 nowadays.
Original credits: I dont remember :( I searched for the internet, but couldn't find where I found this script in the first place.
Great many thanks to the original author anyway. :)
macroScript MacroscriptLister
category:"Haider"
toolTip:"Macroscript Lister..."
buttontext:"Macroscript Lister..."
(
(
rollout macroList "Macroscript List" (
local mcrCategories;
local mcrNames;
local mcrTexts;
dropdownlist categoryList;
dropdownlist mcrNamesList;
button runMcr "Run";
on categoryList selected arg do (
mcrNamesList.items = mcrTexts[arg];
)
on runMcr pressed do (
--try (
macros.run categoryList.selected mcrNames[categoryList.selection][mcrNamesList.selection];
--) catch ()
)
)
local mcrCategories = #();
local mcrNames = #();
local mcrTexts = #();
local mcrFiles = #();
local mcrStream = stringstream "";
macros.list to:mcrStream;
seek mcrStream 0;
while (not (eof mcrStream)) do (
local line = (readDelimitedString mcrStream "\n");
local lineSplit = (filterString line "\"");
local mcrName = lineSplit[2];
local mcrCategory = lineSplit[6];
local mcrFile = lineSplit[8];
local catIndex = (findItem mcrCategories mcrCategory);
if (catIndex == 0) do (
append mcrCategories mcrCategory;
append mcrNames #();
append mcrTexts #();
append mcrFiles #();
catIndex = mcrCategories.count;
)
append mcrNames[catIndex] mcrName;
append mcrTexts[catIndex] mcrName;
append mcrFiles[catIndex] mcrFile;
)
local grinIndex = (findItem mcrCategories "Grin tools");
if (grinIndex != 0) do (
if (mcrFiles[grinIndex] != undefined) do (
for i = 1 to mcrFiles[grinIndex].count do (
local mcr = openFile mcrFiles[grinIndex][i];
if (mcr != undefined) do (
seek mcr 0;
skipToString mcr "toolTip:";
readDelimitedString mcr "\"";
local newName = readDelimitedString mcr "\"";
if (newName == "") do (
seek mcr 0;
skipToString mcr "buttonText:";
readDelimitedString mcr "\"";
newName = readDelimitedString mcr "\"";
)
if (newName != "") do mcrTexts[grinIndex][i] = newName;
)
)
)
)
createdialog macroList width:400 style:#(#style_toolwindow, #style_sysmenu);
macroList.categoryList.items = mcrCategories;
macroList.mcrNames = mcrNames;
macroList.mcrTexts = mcrTexts;
cui.RegisterDialogBar macroList;
)
)
By
Comments (13)
Comment policy
.
Yes, I think I know now who gave me the first script :)
.
Thank you very much.
Maybe this one could be published soon ;)
.
You have to publish it from the name of its original creator. :)
.
Works splendid. Thank you.
If you're in the mood to add an update, then:
- a parameter where the user can type what default category to show. Eg "miauu" is my most used category, then it opens that category upon running the script. If not defined, then the first is shown.
ps. about that code I commented out - can you read from it what it does?
.
You can see where to write the default category.
The comented part of the script searches for a script category with name "CatName". If this category exist then the rest of the codes does something with the name of the scripts by readin them from the mcr files.
.
Hello again,
I noticed that some category items slipped out of the order and the Macroscript is not alphabetical at all. I dont know if I did anything wrong, so I attach the latest code, plus some screen dumps.
There is a part on row 60 I commented out (maybe I shouldn't?) - what does it do?
Attachments
.
Try this:
.
The script will works if you remove the line that register the script as dialog bar. You will no longer be able to dock the UI, but at least the non docked UI will works as it should.
.
Works now, thank you very much.
Why did it crash in the first place? Didnt crash on 2013 what I remember...
- How can the dropdownlist categoryList and mcrNamesList be ordered alphabetically?- - Does maxscript support refresh, so that there could be a button next to "Run", or do I have to close and repoen?
.
.
Many thanks my friend. Works like a charm.
To make it even more useful, I added
and
There is a tiny bug of some sort.
When you run the script, you see the first category, but the dropdownlist mcrNamesList appears empty. You will have to pick the category again to make the mcrNamesList show something.
Can this be fixed?
.
.
Thank you :)