QUESTIONS: OnXxxxMacro Map Notes
DaltonSpence            
            
                Mapmaker             
            I thought I had asked at least one of these questions before but if so I can't remember the answer.
- When the "New Map Wizard" (
NEWWIZ) is used with the "Decide settings myself" option, at least one blank map is saved before any is opened for editing. Does this mean theOnOpenMacronote is run rather than theOnNewMacroone? (If so then the latter would not be needed on "Wizard" templates.) - When a predefined template is used rather than a wizard one, is the 
OnNewMacronote run instead of theOnOpenMacroone, or are both run (if so, in what sequence)?* - While browsing the latest edition of the Tome of Ultimate Mapping I found references to an 
OnLoadMacronote on pages 68 and 426. Was this an earlier version of the other two or can it still be used instead of either if both would be the same? 
* Note that the GETDWGNAME command can only be safely used in the OnOpenMacro note because maps created from predefined templates open with a temporary name of "(Map).FCW" that does not have a path. (I'm thinking about writing a GETMAPVARS macro that generates a SAVEVARS command filename based on the drawing name that could be run when the drawing is opened.)
                            
                            
Comments
2. Predefined maps do not utilize onNewMacro at all, they only run OnOpenMacro immediately when the new map is opened (and every time you open it after that)
3. The references in the Tome is in error. It should refer to OnOpenMacro.
So my afterthought was correct; the working filename for wizard templates would not have a path until it was first saved. This becomes even more complicated if the multilevel option is used.
Oh dear! That means no calling the following macro in the
OnOpenMacroof predefined maps. (I checked; the filename has no path until it is saved.MACRO GETMAPVARS ifdef VFNAME gmvrun getdwgname VFNAME grfn VFNAME VFNAME noextension VFNAME VFNAME apnd VFNAME _vars.scr :gmvrun scriptm VFNAME savevars VFNAME ENDMIf anyone wants to include it in their core macro file, feel free.
I thought it might be something like that. (So the
OnNewMacronote is only used on wizard templates. How interesting.)MULTIFILESCRIPTcommand? I wrote a simple script to change the floor names in the key area of multilevel map ("Floor 1" became "First Floor", "Floor 2" became "Second Floor", etc.) and while it worked on one map when called directly, any attempt to useMULTIFILESCRIPTto change all levels caused the program to crash out.I thought of a one line addition to my macro that might prove useful in the future. Basically I'm saving the relative drawing name (sans extension) in a variable for external file references specific to the drawing.
Also I've had some thoughts about adding a "Welcome" message to the
OnOpenMacronote that can be turned off if requested. (This must be preceded by a call to theGETMAPVARSmacro to work between loads.)GETMAPVARS ifdef HIDETIP ChkTip :WelcomeMsg gn HIDETIP 0 askbox Welcome to this Drawing ... opening message ... Do you want to hide this message in future? iferr HideIt gn HIDETIP 1 :HideIt savevars VFNAME go NoChk :ChkTip ifz HIDETIP WelcomeMsg :NoChkNote that the
 )
HIDETIPvariable can be reset to 0 manually to see the Welcome message the next time the map is loaded, but you must enter "savevars VFNAME" on the command line immediately after for that to work. (Too bad there is noOnCloseMacronote that would be run whenever a map is closed so the mapper didn't have to remember to "savevars VFNAME" every time.To expand on my previous comment a similar bit of code could be placed at the beginning of each macro only drawing tool.
SELSAVE SAVESETTINGS ifdef mdtTIP mdtChkTip gn mdtTIP 0 :mdtWelcome askbox Welcome to this Drawing Tool ... opening message with instructions ... Do you want to hide this message in future? iferr mdtNoChk gn mdtTIP 1 go mdtNoChk :mdtChkTip ifz mdtTIP mdtWelcome :mdtNoChkNote: the "mdt" prefix stands for "Macro Drawing Tool". You might want to change that for your own tools.
GETMAPVARSmacro (or script) in theOnOpenMacronote of a map template unless one really wants to save the variables in a script file in the template folder during it's development. It should only be added to the note after the map is first saved. I'm attaching a zip file with a couple of scripts that might be useful in theOnOpenMacronote. These scripts should be extracted to the "Scripts" folder of the CC3Plus data directory so they can be called by a "scriptm @Scripts\filename.scr" command. TheGETMAPDIMSscript is from the TIP: Determining Map Width in Macros discussion.