RC Menu (dotNet) help
Attached is an image of the concept.
I've got it all working and whatnot.
My question now is.
Does anyone know how I could make this into a macro/hotkey so when you hit a hotkey the RCMenu shows...not the form/dialog?
Right now you have to right click in the dialog for the RCMenu to appear, I want to be able to hit a hotkey or a toolbar button that will make the RCMenu show.
You can test it out. Just change the dir variable to a folder directory which has subfolders with scripts in them.
( local fullPath = undefined dir = @"C:\Users\Crabs User\Desktop\testScripts" --//Main Scripts directory dirArray = GetDirectories (dir+"/*") --//Get subfolders in directory foldersArray = for d in dirArray collect (trimright (filenameFromPath d) "\\") --//Array which stores just the names of the subfolders form = dotnetobject "MaxCustomControls.Maxform" form.Text = "Dynamic ContextMenu" cm = dotNetObject "ContextMenu" form.ContextMenu = cm for i in foldersArray do ( item = cm.menuitems.add i item.name = i ) fn onPopup s e = ( for b = 1 to foldersArray.count do ( i = (s.menuitems.Find (foldersArray[b] as string) off)[1] i.menuitems.clear() sFiles = #() sFiles = getFiles (dirArray[b] + "*.ms*") fn fnRunScript s e = --Run the selected script ( --fileIn s.name fileIn (s.tag) ) if sFiles.count > 0 then --//Add the scripts to appropriate list ( for n in sFiles do ( scriptName = getFIleNameFile n item = i.menuitems.add scriptName item.name = scriptName item.tag = n -- variable "n" contains the fullpath extention dotnet.addEventHandler item "Click" fnRunScript ) ) else ( item = i.menuitems.add "No Scripts" item.enabled = off ) ) ) dotnet.addEventHandler cm "Popup" onPopup form.showmodeless() )
Attachment | Size |
---|---|
concept.jpg | 59.88 KB |
Comments
Can you share the final code
Can you share the final code snippet, thank you
Figured out!
It's all figured out.
I'll post it shortly.
John Martini
Digital Artist
http://www.JokerMartini.com (new site)