June 1997
Macro Q&A
Removing Parameter Names from Dialog Box Code
Q. When I paste a Dialog Editor dialog into my macro, I get all the parameter names
along with the commands. How can I specify that these names aren't included?
A. The parameter names are inserted by default, whether you like it or not. You
can, however, use a fairly simple macro to strip the parameter names from the dialog box
code. Here it is: Application (A1; "WordPerfect"; Default; "US")
ForEach(x; {"Dialog:"; "Left:"; "Top:"; "Width:";
"Height:"; "Style:"; "Caption:"; "Control:";
"Buttontext:"; "Text:"; "Length:"; "Title:";
"MacroVar:"; "Item:"})
SearchString (StrgToLookFor: x)
ReplaceString (RplcStrg: "")
ReplaceForward (SearchMode: Extended!)
PosDocTop ()
ENDFOR
To use this macro, copy the dialog box commands to a blank screen. Run this macro to
remove the parameter names, then copy the revised text back to your main macro.
Hiding Macro Source Code
Q. I sometimes want to distribute a macro in a form that users cannot open, look
at, or edit. Is there a way to keep users from editing the source code?
A. Yes. You can strip the source code from your macros. To do this, create a new
macro that includes code similar to the following:
// ****************************************
// The purpose of this macro is to .......
// See John Doe if you have questions
// PLEASE CLOSE WITHOUT SAVING THIS FILE
//****************************************
INCLUDE("MacroName.WCM")
Substitute the name of your macro where it says MacroName.WCM . When you compile
this macro, all the comamnds from the macro you specified will be included in the macro
prefix area of the new macro. None of the source code will be displayed, but the macro
will operate normally. If a user does open the macro, the comment at the top will let the
user know what type of file they are looking at and who to contact in case of
trouble.

|