|Adjust numbers (eg: parameters)||
Adds a chosen number to a number found at current cursor
This can be repeated any number of times.
Very useful when adjusting eg: items in a Dialog.
The macro consists largely of a callback Dialog. The callback routine is quite short and not hard to understand.
Call up contextual Macro Help
Have cursor in a command and call this macro: the Help page
- once the circumstances are right.
Display, insert, find variables
The macro shows a Dialog listing all vars or Labels (or
both) in the current document. I have found it most useful when revisiting
macros; working on linked macros; and checking macros that I am about to
amalgamate - and it is helpful in the incidental function of identifying typos
that can wreck a macro.|
It allows [Insert] and [Find] var in current document (which may be the original document or another) - and other options.
The macro runs with or without a callback Dialog. The callback routine is short, but calls up a good-sized subroutine.
The macro builds and on command removes items from a one-dimension array.
Format parameter list
Expects a text list - one item to a line - intended for a
parameter list, for eg: array or ForEach(). Adds quotes & semicolons if not
present. Corrects faulty existing format.|
Of course, if the items listed are variables, you do not want the quotes; the macro is insufficiently telepathetic to realise this.
Convert macro command lines from using subroutine=> using
Proc=> using Array
converts eg: a="asd" b="zxy" callroutine to eg:
Converts a set of eg: callproc("abc";"def")- as produced by
mac2proc - to 2 lists in Cols, set up for array definition. You check the
output and call this macro a second time. It detects the Column Code and
converts the Columns to array format.|
The macros are not marvels of elegance, but they did the job.
Uses a one-dimension array simply; the main code is hardly an impressive example.
Usually the macro shows a ListBox of available macros; the
user highlights the name and chooses Play (there is an Edit option). Another
option is to assign the chosen macro to macro altz.wcm via a Persist
If when this macro is called the cursor is in a line that contains a macroname (*.wcm), a Dialog shows that allows the macroname to be Opened or Played.
Two callback Dialogs are included, one simple, one less so.
Uses a one-dimension array of related directories.
The macro is large and uses varied routines; it is not simple to understand.
Remove parameter titles
Removes parameter titles from all commands in document, as
MessageBox (Status:x; Caption:"ThisMacro"; Message:"works well"; Style:OK!) becomes
MessageBox (x;"ThisMacro";"works well";OK!)
Types into the document the value of the Code/character at the
Reports code/char to the L.
Reports code/char to the R.
Save and Run
Saves oodles of time. Shame it took years to think of.|
Now a keystroke Saves (if needed) and Plays the Open macro file.
Adds or removes at start of current line //[space]
If text is Selected when called, toggles the block form /*...*/
If not in a *.wcm document, assumes *.htm or *.html:
then, if it finds < at linestart, toggles <!-- ... -->
Another great timesaver. In current line, types in or
Toggle Label format
Converts earlier Label formats to the neater colon form.|
Removes Call() - at least WP8ff allow use of Label name only.
Converts from WP9 to the earlier form.
I have a great lack of faith in this macro, but when tested it worked.
Calculate next due date
Finds InMonth occurrence of SetDay in
MonsToAdd months on from vStartDate, which is Today.
E.g: 2nd Tuesday in 3rd month from now.|
The macro presently returns its result to a calling macro. It could be edited to allow a user-defined vStartDate, and to show its result in a Dialog or document - you find suitable ideas in Due Date.
hex <=> decimal
Converts Selected text or text input in GetString.|
Outputs to current document. If input is manual and ambiguous, asks: is this hex? before converting.
hex <=> text
Works as above, but converts hex to the ASCII text
equivalent, so that 41 becomes A. Useful among other items for translating
Registry entries in hex. Converts the other way also.|
Does not (but could be edited to) include the manual check of the hex<=>dec macro above.
Create dir from current name
The macro creates a folder name based on selected text and a
filename chosen in a menu.
Three examples of less-than-straightforward Dialogs
Demo of levels in a Dialog; which suggests a neat way to confirm
Depends on and demonstrates well a callback routine.
Dialog has 3 Cols; 2nd is disabled unless specified choice made in 1st;
3rd is hidden unless specific choice made in 1st and 2nd.|
Depends on a somewhat contorted callback routine.
This macro uses 3+1 one-dimension arrays, but it uses the 3 in conjunction with Indirect(). This makes it a useful resource for anyone investigating Indirect(), rather complex for someone starting work with arrays.
Creates array of Radio Buttons which are displayed in Columns in a Dialog
- could be useful for eg: some multiple-choice test or survey.|
You decide how many Rows/Cols - the macro produces the Dialog.
Uses two associated one-dimension arrays in a way more straightforward than is most of the macro.
Example document fill-in routines
This was written swiftly for a user who wished to see various methods of
inserting material into a form document. The macro shows a Dialog; the user
selects/inputs the required details; the macro inserts them into the prepared
document. Some/all items can be chosen from a prepared list rather than typed
anew, with the consequent possibility of typos.
The document into which the macro inserts the data.
Get current font
Reports in Dialog: Font and Size at cursorpos.|
When [Choose] clicked, returns current Font, Size in Global variables.
To make this macro work for you, you would Run() it from another macro.
This macro reports in vars: Global vFont and vFontSize
and then you can do whatever you choose with vFont and vFontSize -
- perhaps set current document font to those values . . . ..
Uses a callback routine, but only to terminate the macro.
Identify Open documents
Contains these routines:|
- Check whether TargetDoc is Open (three variations)
- Using the above, move to or Open a document, if possible;
- List Open docs in an Array; with/out a second list of ?DocNumbers;
- Use the two-lists version to instantly discover whether a file is Open (if so, you can switch directly to that file, else: Open it);
- Close all files matching a specification.
One routine returns a list of open documents in a one-dimension array.
One routine returns a list of open documents and ?DocumentNumbers also in a two-dimension array, which a third routine interrogates. Good for newbies.
Report WPG 1/2
Expects a doc with path\filenames of .wpg files, one to a
IDs and reports at the bottom of the document the WPG type of each file.
Set Find/Replace defaults
Contains one Procedure, which you could Use() or
Avoids surprises during F/R actions by establishing the WP defaults.
Set Registry pointers to PS9 or later
PerfectScript v8 sets the registry pointers to itself, very
Later versions do the same, but using 1 or 5 MessageBox/es.
This macro sets the pointers to v9/10/11/12 (you set this up), reports the current entries and, if different, reports the registry entries it discovered. Doing this before running WP9..12 causes the MessageBox to not show, and if while using eg: WP12 you used WP8, restores matters.
Uses a one-dimension array, but not very helpfully.
This was designed as a worked example for a newbie who
wished for a controlled File|Open substitute routine.|
I trust it will help others also.
may also help, because|
macro files are WP files
here an alphabetical list of all macro titles.