PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: SHARING HEADERS - HTML + REXX CGI[Next]: Accessing SQL DATABASES Directly
\ -> Examples / Tips -> TEXTEDIT with PPWIZARD

TEXTEDIT with PPWIZARD

I have another handy program called TEXTEDIT, it takes a text file as input. PPWIZARD can simplify handling of any text file and this example shows how I have used it to create some "macro" commands that not only simplifies the syntax but checks the return code (TEXTEDIT aborts on error).

The code shown here is a small fragment of what I use to completely automatically extract menus, dialogs, etc., out of Netscape and modify or delete controls, then put the modified resources back into Netscape.

DLG102.TE - The MAIN Program

;--------------------------------------------------------
;--- Edits dialog 102 of Netscape 4.04 "Communicator" ---
;--------------------------------------------------------

;--- Include header file ----------------------------------------------------
#include   "DIALOG.H"

;--- Disable Choose file button ---------------------------------------------
<$DisableControlLineGivenMiddle LINE=^<$DLG_CHOOSE_FILE>^>

;--- Disable "Composer" radio button ----------------------------------------
<$DisableControlLineGivenMiddle LINE=^<$DLG_COMPOSER>^>

;--- Thats all Folks! -------------------------------------------------------
<$WriteFile>

DIALOG.H - Dialog Specific Header

;--- Include generic stuff -------------------------------------------------
#include "TEXTEDIT.H"

;--- Constants -------------------------------------------------------------
#define DLG_CHOOSE_FILE         Choose ~File
#define DLG_COMPOSER            ~Composer

;--- Disable Control -------------------------------------------------------
#define DisableControlLineGivenMiddle                                            \
        ReplaceLines {$COUNT="1"} ^*{$LINE}*^ ^${ReplacedLine}, WS_DISABLED^    %\
        <?Hash>if  '${Rc}' <> '0'                                               %\
               @exit 255 'Could not find a control line matching = "*{$LINE}*"' %\
        <?Hash>endif

TEXTEDIT.H - Generic Header (for dialogs, menus etc)

;--- Macro to delete a line ------------------------------------------------
#define DeleteLineGivenMiddle                                            \
        DeleteBlock ^*{$LINE}*^   ^*{$LINE}*^                           %\
        <?Hash>if  '${Rc}' <> '0'                                       %\
               @exit 255 'Could not find a line matching = "*{$LINE}*"' %\
        <?Hash>endif

;--- Write changed data to file --------------------------------------------
#define WriteFile                                            \
        ;--- Pretty up the final code (easier to read) ---  %\
        top                                                 %\
        ReplaceText 9999 "BEGIN" "{"                        %\
        ReplaceText 9999 "END"   "}"                        %\
                                                            -\
        ;--- Write the file ------------------------------  %\
        checkpoint

;--- Find a line -----------------------------------------------------------
#define MustFindLineGivenMiddle                                          \
        Find {$COUNT="1"} ^*{$LINE}*^                                   %\
        <?Hash>if  '${Rc}' <> '0'                                       %\
               @exit 255 'Could not find a line matching = "*{$LINE}*"' %\
        <?Hash>endif


email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: SHARING HEADERS - HTML + REXX CGI[Next]: Accessing SQL DATABASES Directly


PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Saturday May 28 2022 at 2:55pm