[Closed] Autocomplete code in Maxscript editor POSSIBLE!!!
keep in mind that apropos would only list classes… you’d probably miss, at least, for/when/if/then/else/etc. language constructs.
That’s a lot of ‘case of’s for something that seems to be fed to the same array 😮
I’m using this list for some time now:
http://scripts.subd.nl/?f=maxscript.api
It’s also extracted from a file Chris Johnson posted somewhere, I think on scriptspot. I think it’s a bit more then what was posted here already. And the maxscript editor also has some more options for the autocomplete context sensitive stuff. I will try to post about it soon and the use of a .api file instead of the “abbreviation trick” which is the proper way to do it. Well in fact the autocompleet should reflect the same keywords there are exposed for the color coding, but for some strange reason just aren’t.
-Johan
this one will filter by color type which is what I wanted
(
fn GatherMaxscriptKeyword =
(
out_script=newscript()
n_stream=stringstream ""
--//--
afilter_black=#()
afilter_blue1=#()
afilter_blue2=#()
afilter_Brown=#()
afilter_Green=#()
afilter_Gold=#()
afilter_Red=#()
afilter_Italic=#()
--//--
apropos "" to:n_stream
seek n_stream 0
--//--
while not eof n_stream do
(
mtrim=(dotnetobject "system.string" (readLine n_stream)).Split "("
--//--
if mtrim.count > 1 then
(
xtype=(dotnetobject "system.string" mtrim[2]).split ")"
--//--
if xtype.count > 1 then
(--redirect to the wanted array there ...
appendvalstr=((dotnetobject "system.string" mtrim[1]).Split " ")[1]
--//--
case xtype[1] of
(
"<internal>":(appendifunique afilter_black appendvalstr)
"Array":(appendifunique afilter_black appendvalstr)
"BooleanClass":(appendifunique afilter_black appendvalstr)
"Float":(appendifunique afilter_black appendvalstr)
"Integer":(appendifunique afilter_black appendvalstr)
"MAXScriptFunction":(appendifunique afilter_black appendvalstr)
"MSCustAttribDef":(appendifunique afilter_black appendvalstr)
"MSPluginClass":(appendifunique afilter_black appendvalstr)
"Point2":(appendifunique afilter_black appendvalstr)
"Primitive":(appendifunique afilter_blue1 appendvalstr)
"RCMenu":(appendifunique afilter_black appendvalstr)
"RolloutClass":(appendifunique afilter_black appendvalstr)
"StandardMaterialClass":(appendifunique afilter_black appendvalstr)
"String":(appendifunique afilter_black appendvalstr)
"StructDef":(appendifunique afilter_Brown appendvalstr)
"TextureClass":(appendifunique afilter_black appendvalstr)
"UndefinedClass":(appendifunique afilter_black appendvalstr)
"const BipedGeneric":(appendifunique afilter_blue1 appendvalstr)
"const BooleanClass":(appendifunique afilter_Italic appendvalstr)
"const Class":(appendifunique afilter_blue2 appendvalstr)
"const Color":(appendifunique afilter_Italic appendvalstr)
"const CurveCtlGeneric":(appendifunique afilter_blue1 appendvalstr)
"const EmptyClass":(appendifunique afilter_Italic appendvalstr)
"const Float":(appendifunique afilter_Italic appendvalstr)
"const Generic":(appendifunique afilter_blue1 appendvalstr)
"const HKey":(appendifunique afilter_Italic appendvalstr)
"const Interface":(appendifunique afilter_Green appendvalstr)
"const MAXClass":(appendifunique afilter_blue2 appendvalstr)
"const MAXMeshClass":(appendifunique afilter_blue1 appendvalstr)
"const MAXScriptFunction":()--empty
"const MAXSuperClass":(appendifunique afilter_blue2 appendvalstr)
"const MappedGeneric":(appendifunique afilter_blue1 appendvalstr)
"const MappedPrimitive":(appendifunique afilter_blue1 appendvalstr)
"const MeditMaterialsClass":(appendifunique afilter_Italic appendvalstr)
"const NodeGeneric":(appendifunique afilter_blue1 appendvalstr)
"const ObjectSet":(appendifunique afilter_Gold appendvalstr)
"const OkClass":(appendifunique afilter_Italic appendvalstr)
"const Point3":(appendifunique afilter_Italic appendvalstr)
"const Primitive":(appendifunique afilter_blue1 appendvalstr)
"const Primitive":()--empty
"const SelectionSetArray":(appendifunique afilter_Italic appendvalstr)
"const StructDef":(appendifunique afilter_Brown appendvalstr)
"const UndefinedClass":(appendifunique afilter_Italic appendvalstr)
"const UnsuppliedClass":(appendifunique afilter_Italic appendvalstr)
"dotNetObject":(appendifunique afilter_black appendvalstr)
"persistent UndefinedClass":(appendifunique afilter_black appendvalstr)
"system Array":(appendifunique afilter_Red appendvalstr)
"system BooleanClass":(appendifunique afilter_Red appendvalstr)
"system Color":(appendifunique afilter_Red appendvalstr)
"system Control":(appendifunique afilter_Red appendvalstr)
"system Float":(appendifunique afilter_Red appendvalstr)
"system Integer":(appendifunique afilter_Red appendvalstr)
"system Integer64":(appendifunique afilter_Red appendvalstr)
"system Interval":(appendifunique afilter_Red appendvalstr)
"system MAXRootNode":(appendifunique afilter_Red appendvalstr)
"system MAXTVNode":(appendifunique afilter_Red appendvalstr)
"system MaterialLibrary":(appendifunique afilter_Red appendvalstr)
"system Name":(appendifunique afilter_Red appendvalstr)
"system String":(appendifunique afilter_Red appendvalstr)
"system Time":(appendifunique afilter_Red appendvalstr)
"system UndefinedClass":(appendifunique afilter_Red appendvalstr)
"system WindowStream":(appendifunique afilter_Red appendvalstr)
default:(messagebox "New Class found, Please update the main function." title:"Warning" beep:false)
--default:(format(xtype[1]+"
")to:out_script)
)
)
)
)
--//--Black keyword
sort afilter_black
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Black"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_black do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--blue1 keyword
sort afilter_blue1
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Blue1"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_blue1 do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--blue2 keyword
sort afilter_blue2
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Blue2"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_blue2 do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--Brown keyword
sort afilter_Brown
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Brown"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_Brown do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--Green keyword
sort afilter_Green
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Green"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_Green do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--Gold keyword
sort afilter_Gold
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Gold"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_Gold do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--Red keyword
sort afilter_Red
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Red"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_Red do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
--//--Italic keyword
sort afilter_Italic
format ("-------------------------------------------------------------"+"
") to:out_script
format ("Italic"+"
") to:out_script
format ("-------------------------------------------------------------"+"
") to:out_script
--//--
for f in afilter_Italic do
(
evalstr=(dotnetobject "system.string" f).Split ("\""+"&"+"%")
--//--
if evalstr.count == 1 then
(
format (evalstr[1]+"
") to:out_script
)
--//--
)
)
--//--
GatherMaxscriptKeyword()
ok
)
ah, well, if you wanted them separated by the default syntax coloring, you could’ve stuck all the words, one per line, in a script file, exported to HTML, then parse the HTML
Yes, I suppose it would be more accurate this way …unfortunately, I don’t know HTML well enough to do this
Hi guys,
some time ago I collected all keywords form MaxScript 2009 Reference in a textfile to make a synthax highlighter for PSPad, the editor I still use. In the attachment you can find the raw list sorted by argument with punctuation and symbols. I guess some passes through regular expressions could make it suitable for any use. It has indeed to be updated to 2010, but I hope it could be the same of some help.
- Enrico
Ho! just realized that “const Primitive” was duplicate …that’s why it was empty …did you guy have noticed ?