PDA

View Full Version : How to run macros in a script


Tingspain
07-20-2006, 03:37 AM
Hi, I am trying to adapt the CommonTools to my fulfill my need, I would like create certain buttons to control the MaxScript. I tryed to find the way to call the macroscript used in max to openScript, runScript, Macro Recorder, etc.... however i could find a way to access this kind of macro. So please I will be very grateful if anyone could tell me how i can access from a script to the macro of max.

Regards
_ting_

Bobo
07-20-2006, 03:53 AM
Hi, I am trying to adapt the CommonTools to my fulfill my need, I would like create certain buttons to control the MaxScript. I tryed to find the way to call the macroscript used in max to openScript, runScript, Macro Recorder, etc.... however i could find a way to access this kind of macro. So please I will be very grateful if anyone could tell me how i can access from a script to the macro of max.

Regards
_ting_

Check out the macros structure (documented on the page titled "Macro Scripts") in the Reference.

For example
macros.run <category_string> <name_string>

Pass the name of the category and of the macro itself and it will be run.

Tingspain
07-20-2006, 10:32 AM
Thank Bobo, however I already checked the macros.* before to post my question and i couldnt get it to work. I dont know what are the <category_string> and the <name_string> for the follogin macros: New Script, Open Script, Run Script and Macro Recorder Toggle. If anyone could help me out with this i will be very gratefull.

Thank again Bobo to make my process of learning MaxScript easier.

Regards,
_ting_

Tingspain
07-20-2006, 02:26 PM
Hi Bobo, I am tring to do in that way:

on newScript_btn pressed do
(
macros.run "MAX Script" "New Script"
)

however i get this error:

"--Runtime error: No shuch macro-script: New Script"

What is wrong ?

Thank in advance,
_ting_

Bobo
07-20-2006, 02:31 PM
Thank Bobo, however I already checked the macros.* before to post my question and i couldnt get it to work. I dont know what are the <category_string> and the <name_string> for the follogin macros: New Script, Open Script, Run Script and Macro Recorder Toggle. If anyone could help me out with this i will be very gratefull.

Thank again Bobo to make my process of learning MaxScript easier.

Regards,
_ting_

Not all Menu Items are actully MacroScripts. The ActionItems system of Max can be populated by both plugins and scripts, so many of the icons and menu items you see are not scritped but exposed by the system.

You can see whether a menu item is a MacroScript or not by opening the Customize dialog in Menu tab and right-clicking on the menu items in the right tree structure - if the option "Edit Macro Script" is disabled, it is not a MacroScript...

But you can use the MacroRecorder to see what the actionMan action numbers for these operations are (except for the MacroRecorder action itself, which of course cannot be recorded, but happens to be just one above Run Script...)

actionMan.executeAction 0 "40468" -- MAX Script: Open Script
actionMan.executeAction 0 "40469" -- MAX Script: New Script
actionMan.executeAction 0 "40470" -- MAX Script: Run Script
actionMan.executeAction 0 "40471" -- MAX Script: Toggle MacroRecorder

Tingspain
07-20-2006, 03:02 PM
THANK VERY MUCH Bobo, it works perfect. I tried before using the method that you suggested to me however i didnt write the complete command so that is why it dosnt work perfectly.

Thank Bobo_ting_

CGTalk Moderation
07-20-2006, 03:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.