home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / menustuf.sit / SetMenu.p.bin / SetMenu.p
Encoding:
Text File  |  1990-02-19  |  1.0 KB  |  47 lines  |  [TEXT/MPS ]

  1. Program SetMenu;
  2. {
  3.     This program is an MPW tool which changes the text for a specified
  4.     menu item. Call it from the MPW Shell as follows:
  5.  
  6.         SetMenu menuName itemNo itemText
  7.  
  8.     where menuName is the name of the menu to be altered, itemNo is the
  9.     number of the menu item, and itemText is the new item text.
  10.  
  11.     Written by LDO 1988 October 29.
  12.     Modified 1989 January 4 to initialise QuickDraw (just in case) and
  13.     move useful stuff to MenuStuffCommon for use by the other tools in this set.
  14. }
  15.  
  16.     Uses
  17.         MemTypes,
  18.         QuickDraw,
  19.         OSIntf,
  20.         ToolIntf,
  21.         PackIntf,
  22.         IntEnv,
  23.         MenuStuffCommon;
  24.  
  25.     Var
  26.         TheMenu : MenuHandle;
  27.  
  28.   Begin
  29.     InitGraf(@ThePort);
  30.     If ArgC > 3 then
  31.       Begin
  32.         TheMenu := FindMenu(ArgV^[1]^);
  33.         If TheMenu <> Nil then
  34.             SetItem(TheMenu, StringToNum(ArgV^[2]^), ArgV^[3]^)
  35.         else
  36.           Begin
  37.             Writeln(Diagnostic, '### ', ArgV^[0]^, ' - menu "', ArgV^[1]^, '" not found');
  38.             IEExit(2)
  39.           End
  40.       End
  41.     else
  42.       Begin
  43.         Writeln(Diagnostic, '### ', ArgV^[0]^, ' - not enough arguments');
  44.         IEExit(1)
  45.       End
  46.   End {SetMenu}.
  47.