home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma56.dms / ma56.adf / StartMenu / Extras / SMRexx / README < prev    next >
Text File  |  1996-04-13  |  4KB  |  125 lines

  1. SMRexx - ARexx interface to StartMenu (v2.0 required)
  2.  
  3. SMRexx is a stand-alone program that opens an ARexx port named
  4. "START_REXX".  ARexx scripts can access this port to add buttons
  5. to StartMenu's TaskBar.
  6.  
  7. SMRexx requires the "easyrexx.library" be copied to your LIBS: drawer.
  8. easyrexx.library is copyrighted 1994, 1995 to Ketil Hunn.
  9.  
  10. USAGE:
  11. The simplest method is to put SMRexx into StartMenu's StartUp
  12. drawer so that SMRexx is automatically run whenever StartMenu
  13. runs.
  14.  
  15. After it has loaded, it just sits around waiting for ARexx programs
  16. to access its port.
  17.  
  18. To quit SMRexx, either send it CTRL-C or, quit StartMenu
  19.  
  20. COMMANDS
  21. SMRexx currently only accepts five commands:
  22.  
  23.     Command      Template
  24.     -------      --------
  25.     ADD_TASKBAR  PORT/A,NAME/A,TEXT/K,IFF/K,ICON/K   ;Make Taskbar button
  26.     ADD_CLOCK    PORT/A,NAME/A,IFF/K,ICON/K          ;Make clock button
  27.     REM_TASKBAR  NAME/A                              ;Remove Taskbar button
  28.     REM_CLOCK    NAME/A                              ;Remove clock button
  29.     TOGGLE       NAME/A                              ;Toggle state of button
  30.  
  31. The Arguments are:
  32.  
  33.     PORT - (REQUIRED) It must be the name of an ARexx port created by
  34.            your script
  35.  
  36.     NAME - (REQUIRED)  This will be the button's identifier.
  37.  
  38.     TEXT - (NOT REQUIRED) For Taskbar buttons only.  The text inside the
  39.            button.
  40.  
  41.     IFF  - (NOT REQUIRED) Full path/name of an IFF ILBM picture to use as
  42.             the icon.
  43.  
  44.     ICON - (NOT REQUIRED) Full path/name of an program icon file who's
  45.            imagery will be used for the icon. NOTE: do not append the
  46.            ".info" extension to the filename (i.e. "Sys:Utilities/Clock"
  47.            not "Sys:Utilities/Clock.info").
  48.  
  49. NOTES:
  50.     If you are creating a taskbar button you must supply one or more
  51.     of TEXT, IFF, ICON.
  52.  
  53.     If you are creating a clock button you must supply either IFF or
  54.     ICON.
  55.  
  56.     IFF and ICON are mutually exclusive.  Only supply one or the other.
  57.  
  58.     Taskbar buttons are TOGGLESELECT. Use the TOGGLE command to change the
  59.     state of a TaskBar button.
  60.  
  61. MESSAGES FROM SMRexx
  62. SMRexx wiil send messages to your script in this format:
  63.  
  64.         "id command"
  65.  
  66. Where "id" is the name of a gadget that you created and "command" is
  67. either "HIT" or "REMOVE".  You will receive the "HIT" command when
  68. your button has been clicked and the "REMOVE" command when StartMenu
  69. is quittong and needs to remove your button from the tasbar.
  70.  
  71. Example:  if you create a button named "MY_BUTTON" SMRexx will send you
  72. this message when your button is clicked:
  73.     "MY_BUTTON HIT"
  74. (The quotes WILL NOT be part of the message)
  75.  
  76. STEPS FOR MAKING BUTTONS
  77. To create a script, you would do the following steps:
  78.  
  79. 1. Open the "rexxsupport.library"
  80.     AddLib('rexxsupport.library',0,-30,0)
  81.  
  82. 2. Check to make sure SMRexx is running:
  83.     if (~Show('P', 'START_REXX')) then exit
  84.  
  85. 3. Create an ARexx port:
  86.     if (~OpenPort(MY_PORT)) then exit
  87.  
  88. 4. Create one or more buttons
  89.     /* Create a clock button */
  90.     address START_REXX ADD_CLOCK MY_PORT MY_BUTTON IFF=mypic.iff
  91.  
  92. 5. Make sure the button was created:
  93.     if (0 ~= rc) then exit
  94.  
  95. 6. Start an event loop, waiting for a button press:
  96.     do forever
  97.         WaitPkt(MY_PORT)            /* Wait for message */
  98.         do forever
  99.             p = GetPkt(MY_PORT)     /* Get the message */
  100.             if (0 == C2D(p)) then leave     /* No more messages? */
  101.             arg = GetArg(p)         /* Parse the message */
  102.             Reply(p, 0)             /* Return message */
  103.  
  104.             gad_id = SubWord(arg, 1, 1)    /* Get the gadget id */
  105.             comnd  = SubWord(arg, 2, 1)    /* Get the command */
  106.  
  107.             if (gad_id == MY_BUTTON)        /* Check the id */
  108.                 if ("HIT" == comnd) then do  /* A button press */
  109.                     /* Whatever */
  110.                     end
  111.                 else quitflag = 1      /* Must be REMOVE */
  112.                 end
  113.             end
  114.         end
  115.  
  116. 7. If you are terminating the script, remove the button.  Do not
  117.    remove the button if you received a REMOVE message!
  118.  
  119.    address START_REXX REM_CLOCK MY_BUTTON
  120.  
  121. 8. Close your port
  122.     CosePort(MY_PORT)
  123.  
  124.  
  125.