home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_01 / demomacr.c < prev    next >
C/C++ Source or Header  |  1991-02-28  |  1KB  |  66 lines

  1.  
  2. /* demo macro
  3.  *
  4.  *    shows how keyboard macro facility is installed and used.
  5.  */
  6. #include <stdlib.h>
  7. #include "wtwg.h"
  8.  
  9. main ()
  10.     {
  11.     int n;
  12.  
  13.     char         msg[80];
  14.     WMACRO_NAMES       *mn;
  15.     int                key;
  16.  
  17.     winit ('T');
  18.  
  19.  
  20.     /* Install keyboard macro routines.
  21.      * Pressing ALT= activates the amcro recorder,
  22.      * which asks for a key to assign the new macro to (ALT_1 thru ALT_0)
  23.      * then asks for a name for the file macname.mcr to store macro in.
  24.      * then begins recording all key and mouse use until next ALT=
  25.      */
  26.     wmacro_install ();
  27.  
  28.     do    {
  29.  
  30.         msg[0] =0;
  31.  
  32.         wprompts ( "TYPE HERE", "enter word or two\n"
  33.             " use macros by pressing ALT=\n\n  ",
  34.             msg, 80 );
  35.  
  36.         key = wpromptc ( "ECHO", msg, NULL );
  37.  
  38.         }
  39.     while ( key != ESCAPE );
  40.  
  41.  
  42.     /* get ptr to table of names of defined macros.
  43.      */
  44.     mn = wmacro_names();
  45.  
  46.     wclear();
  47.     for ( n=0; n<10; ++n)
  48.         {
  49.         if ( *mn[n] )
  50.             {
  51.             wprintf ("MACRO #%i name=%s\n",n,(*mn)[n] );
  52.             }
  53.         else
  54.             {
  55.             wprintf ("MACRO #%i is undefined\n", n);
  56.             }
  57.         }
  58.  
  59.     wputs ("\nPress any key ");
  60.  
  61.     /* wait */
  62.     wgetc();
  63.  
  64.     return (0);
  65.     }
  66.