home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 61 / af061a.adf / Macros / MakeFileGadgets.clssa < prev    next >
Text File  |  1993-05-01  |  2KB  |  67 lines

  1. /***********************************************************************
  2.  $DAT >>MakeFileGadgets.clssa<< 01 May 1993 - (C) ProDAD Holger Burkarth
  3.  
  4.   Searces for files with the label ".clssa" in the selected path. If
  5.   only one file can be found, which has the keyword "GADGET:" in the
  6.   first ten lines then this file will be displayed as Gadget. The
  7.   gadget name must appear in quotes behind the keyword. After this
  8.   comes the 'page', also in quotes, followed by the preferred gadget
  9.   position or, alternatively, "AUTO".
  10. ************************************************************************/
  11.  
  12. Options RESULTS
  13. PARSE ARG InputVar
  14.  
  15.   IF Open(gaddef,"clariSSA.gadgets",'Write') THEN DO
  16.     call Writeln(gaddef,"GADGETS")
  17.     DO FOREVER
  18.       PARSE VAR InputVar filename InputVar
  19.       IF filename="" THEN IF ARG~="" THEN LEAVE
  20.  
  21.       GFail=0
  22.       IF filename ="" THEN DO
  23.         GetDirectory 'REQ NAME "REXX:" TITLE "ARexx Module as GADGETS" FULL FILES'
  24.       END; ELSE DO
  25.         GetDirectory 'NAME' filename 'TITLE "ARexx Module as GADGETS" FULL FILES'
  26.       END
  27.  
  28.       Files=result
  29.       IF rc~=0 | Files="0" THEN exit
  30.  
  31.       PARSE VAR Files pos Files
  32.  
  33.       DO FOREVER
  34.         PARSE VAR Files 'FILE "' Name '"' Files
  35.         IF INDEX(Name,".clssa") > 0 THEN DO
  36.           GadName=""
  37.           IF Open(loadit,Name,'Read') THEN DO
  38.             Zeile=1
  39.             DO FOREVER
  40.               Zeile=Zeile+1
  41.               string = Readln(loadit);
  42.               IF string = "" | Zeile >= 10 THEN LEAVE
  43.               PARSE VAR string . 'GADGET: "' GadName '" "' GPage '"' GPos 'TYP: "' Type '"' .
  44.               IF GadName~="" THEN DO
  45.                 call Writeln(gaddef," GADGET PAGE" GPage GPos GadName "ARexxMacro NAME '"Name"'")
  46.                 GADGET "PAGE" GPage GPos GadName "ARexxMacro NAME '"Name"'"
  47.                 IF rc > 0 THEN GFail=1
  48.                 LEAVE
  49.               END
  50.             END
  51.             CALL Close(loadit);
  52.           END
  53.           IF GFail > 0 THEN LEAVE
  54.         END
  55.         IF Files="" THEN LEAVE
  56.       END
  57.  
  58.     END
  59.     call Writeln(gaddef,"#")
  60.     CALL Close(gaddef);
  61.   END
  62.   ELSE Message "'Unknown Error ?????'"
  63.  
  64.   RemakeDisplay 'GADGETS'
  65.  
  66. exit
  67.