Purpose
Replace block of text in all active buffers.
Operation
The steps required to operate this function are:
- Load all files to be manipulated into CodeWright buffers.
- Copy Find Block to tlaBlockReplace dialog.
- Select Hold button.
- Copy an example of Replace Block to tlaBlockReplace dialog.
- Select OK button.
- Every occurrence of Find Block will be replaced by Replace Block in every active buffer.
This function solves the limitation imposed by the absence
of a modalless dialog box in CodeWright AppBasic.
(Note:The AppBasic "language" is the only capability in
CodeWright that supports the generation of a dialog. This is
the only reason the AppBasic "language" was chosen for the
implementation.)
Example
- Load all files to be manipulated into buffers.
- Select the text to Find.
- Issue Ctl-C (copy).
- Invoke tlaBlockReplace.
- Select Find Block.
- Issue Ctl-V (paste).
- Select the Hold button.
- Select an example of the text to be the result.
- Issue Ctl-C (copy).
- Invoke tlaBlockReplace.
- Select Replace Block.
- Issue Ctl-V (paste).
Input Parameters
None.
Optional filename.
Return Codes
Code
|
Message
|
Normal
|
tlaBlockReplace: number Blocks Replaced.
|
Error
|
tlaBlockReplace: No find block specified.
|
Error
|
tlaBlockReplace: No buffers currently loaded.
|
Reference
tlaBlockReplace is also published on the Starbase website at
kbase.starbase.com/Articles/Default.asp?config=2&id=9246
Compatibility
Current version verified under:
- CodeWright 7.0b
- CodeWright 7.0c
- CodeWright 7.5.1
- CodeWright 7.5.2
- CodeWright for .NET 7.0 - function not available
CodeWright for .NET Restriction
Application Basic Macros are not supported under CodeWright
for .NET. This capability can therefore not be used n that
environment.
Installation
- Enable the AppBasic DLL in CodeWright ...
- Open the CodeWright Customize | Libraries.. dialog (6.5 and above), Tools | Customize | Libraries... (6.0) or Tools | Libraries (5.1 and older).
- Check the box to the left of AppBasic Macro Language label.
- Select the OK button.
- Save the macro to disk ...
- Select the Code button on this page.
- When the second window opens, select all the text in the text box.
- Issue Ctl-C (copy).
- Issue File | New... to create a new empty buffer.
- Enter a file name like tlaBlockReplace.cwb.
- Specify an appropriate directory.
- Select the OK button.
- Load the macro from either of two locations:
- Either ... use the AppBasic window ...
- Select the AppBasic tab of the Output window.
- Select the Open button on the AppBasic button bar.
- Navigate to the directory where you stored tlaBlockReplace.cwb.
- Double-click on tlaBlockReplace.cwb to load the macro in the AppBasic editing window.
- Select the Start/Resume button on the button bar.
- Or use the AppBasic Macro Extension Macro dialog ...
- Select Tools | AppBasic Macros | Load Macros....
- Check the box to the right of tlaBlockReplace.
- Select OK.
|