[Closed] List installed macros
Okay, I need to produce a list of avaliable installed macros.
I’m currently using a combination of macros.list(), listener selection and memstream to print a list of installed macros to the listener, select that list, copy it to a string and then parse it using a memstream…
While this does work, it works like an old battered donkey…Please, does any one know of a simple way to get a list of installed macros stright into a collection or array!!!
And just in case you thought I was crazy, here’s the code to prove it
struct ZOMacroDef (
iId,
sName,
sCatagory,
sSource,
fn toString = (
return "id = " + (iId as string) + "; Name = " + sName + "; Catagory = " + sCatagory + "; sSource = " + sSource
)
)
(
clearListener()
Macros.list()
setListenerSel #(0, -1)
local sText = getListenerSelText()
local sStream = memStreamMgr.openString sText
local lstMacros = #()
while (sStream.peekToken() != undefined) do (
local sId = sStream.readToken()
local sName = sStream.readToken()
local sCatagory = sStream.readToken()
sStream.readToken() -- The catagory is listed twice for some reason...
local sSource = sStream.readToken()
if sId != undefined and sName != undefined and sCatagory != undefined and sSource != undefined then (
local macroDef = ZOMacroDef iId:(sId as integer) sName:sName sCatagory:sCatagory sSource:sSource
append lstMacros macroDef
) else (
format "Last element = sId = %; sName = %; sCatagory = %; sSource = %
" sId sName sCatagory sSource
)
)
--close sStream
)
Why in gods name they simply dump the list to the listener is beyond me
Cheers
Shane
They don’t tell you but:
ss = stringstream ""
Macros.list to:ss
I normally try doing this to anything that prints to the listener to see what happens!
PS. Both myself and Light have already created a tool that lists all macros and sticks them in a categorized list that docks on one side of the screen. Shout if you want it.
Thank you very much!
and in words of “pudgerboy” << SHOUT >>
Yes I’d love to have a look!
Did I mention that my hair line loves you!! This is such a cool method!! Bets the crap out of mine!!
Many, many thanks!
Shane
Hey Shane, Peter,
Here’s that tool I promised ya:Macro Lister 0.5
Lists all installed macros in a tree-view, by category
www.davestewart.co.uk/code/lang/maxscript/workflow/Macro Lister/Macro Lister 0.5.ms
It was just a nice little “can I?” project at the time, but has turned out to be quite a quick way to jump in and muck about with all the available macros that ship with max.
Have fun with it!
Dave