home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / orionful.zip / 3rdParty / Newtooldmenus.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-02-16  |  7KB  |  227 lines

  1. /*  Adept 1.08a5+ to Adept v0.01 - 1.07 Menu Converter */
  2. /*  ================================================== */
  3. /*         use it, but dont worry about                */
  4. /*  Remove all *.old and *.new files in menu dir !!!   */
  5. /*  BK  */
  6.  
  7. /*  Converting order:
  8. Key   Command   OutputString   DataString   Color   MinAge   MaxAge   Sec1   Sec2   Flags1   Flags2   StartTime   EndTime   Gender   MinCredit   MaxCredit   MinTime   MaxTime   MinCall   MaxCall   MinPosts   MaxPosts   MinUpl   MaxUpl   MinDl   MaxDl   Group   PortFlags
  9. */
  10.  
  11. call RxFuncAdd 'SysLoadFuncs', 'rexxutil', 'SysLoadFuncs'
  12. call 'SysLoadFuncs'
  13.      tmp=syscls()
  14.  
  15. SIGNAL ON FAILURE NAME CLEANUP
  16. SIGNAL ON HALT    NAME CLEANUP
  17. SIGNAL ON SYNTAX  NAME CLEANUP
  18.  
  19.  
  20. '@echo off'
  21.  
  22. say 'Menu Converion Program for AdeptXBBS v1.07'
  23. say ''
  24. say 'Run this program from in your Menus sub-directory'
  25.  
  26. Call CharOut, 'Enter in the Drive Letter Adept is installed on. [ie D:] : '
  27. Pull Drive
  28. If Pos(':',Drive) = 0 Then Drive = Drive || ':'
  29.  
  30. OldDirectory = Directory()
  31.  
  32. rc = Directory(Drive || '\Adept\Menus')
  33.  
  34. RC = SysFileTree('*.menu', 'fline', 'FO')
  35.  
  36.     say ''
  37.     say '**************************************************************'
  38.     say 'Start converting 'fline.0' 1.08a menus back to 1.07(x) menu structure'
  39.     say' Your directory: 'Directory(Drive || '\Adept\Menus')
  40.     Call CharOut, 'PRESS Enter or Q to quit '
  41.     say ''
  42.     say '**************************************************************'
  43.     say ''
  44.     Pull zeichen
  45.     parse upper value zeichen with zeichen
  46.     if zeichen ='Q' then do
  47.       say ' ... leaving'
  48.       call cleanup
  49.     end
  50.  
  51. counter=0
  52. do i = 1 to fline.0                  /* read in stem *.menu */
  53.  
  54.    Pos = LASTPOS('\', fline.i)
  55.    Len = LENGTH(fline.i)
  56.    FileName = RIGHT(fline.i, (Len - Pos))
  57.  
  58.  
  59.    NewName = FileName||'.New'
  60.    OldName = FileName
  61.    NewOld  = FileName||'.old'
  62.  
  63.    File = FileName
  64.  
  65.    laenge = length(file)
  66.    space=''
  67.    do x=1 to 20-laenge
  68.      space=space||' '
  69.    end
  70.    Say 'Converting menu 'File||space||'->       'file'.NEW'
  71.  
  72.    ret = STREAM( (file) , "C" , "OPEN" )
  73.    ret = STREAM( (newname) , "C" , "OPEN" )
  74.  
  75.    MenuLine = Strip(LineIn(File))
  76.   
  77.    if(MenuLine \= 'BEGINMENU') then do
  78.       say File || ' Already Converted!'
  79.       ret = STREAM( (file) , "C" , "CLOSE" )
  80.       ret = STREAM( (newname) , "C" , "CLOSE" )
  81.       iterate
  82.    end
  83.  
  84.    counter=counter+1
  85.    MenuLine = Strip(LineIn(File,1,1))
  86.    do while(menuline \='BEGINMENUITEM')
  87.             MenuLine = Strip(LineIn(File))
  88.    end
  89.  
  90.    line=''
  91.    key =''
  92.    menucommand =''
  93.    displaystring =''
  94.    displaycolor =''
  95.    DATAOPTION =''
  96.    MINAGE =''
  97.    MAXAGE =''
  98.    SEC1 =''
  99.    SEC2 =''
  100.    FLAGS1 =''
  101.    FLAGS2 =''
  102.    GENDER =''
  103.    STARTTIME =''
  104.    ENDTIME =''
  105.    MINTIME =''
  106.    MAXTIME =''
  107.    MINCALL =''
  108.    MAXCALL =''
  109.    MINPOSTS =''
  110.    MAXPOSTS =''
  111.    MINUPLOADS =''
  112.    MAXUPLOADS =''
  113.    MINDOWNLOADS =''
  114.    MAXDOWNLOADS =''
  115.    GROUP =''
  116.    PORTFLAGS =''
  117.    line=''
  118.  
  119.  
  120.             do while (Lines(File) == 1)           /* Schleife einlesen und abfrage begin */
  121.                MenuLine = Strip(LineIn(File))
  122.            parse value menuline with keyword rest
  123.            keyword=strip(keyword, 'B')
  124.            rest=strip(rest, 'B')
  125.  
  126.                if(keyword == 'MENUCOMMENT')  then do
  127.                   RC = LineOut(NewName, '; '||rest 
  128.                   Iterate
  129.                end
  130.  
  131.                if(MenuLine == '') | (keyword == 'BEGINMENUITEM') then do
  132.                   Iterate
  133.                end
  134.  
  135.                   if (Keyword == 'KEY') then key=rest
  136.                   if (keyword == 'MENUCOMMAND') then menucommand=rest
  137.                   if (keyword == 'DISPLAYSTRING') then displaystring=rest
  138.                   if (keyword == 'DISPLAYCOLOR') then displaycolor=rest
  139.                   if (keyword == 'DATAOPTION') then dataoption=rest
  140.                   if (keyword == 'MINAGE') then minage=rest
  141.                   if (keyword == 'MAXAGE') then maxage=rest
  142.                   if (keyword == 'MINSEC1') then sec1=rest
  143.                   if (keyword == 'MINSEC2') then sec2=rest
  144.                   if (keyword == 'FLAGS1') then flags1=rest
  145.                   if (keyword == 'FLAGS2') then flags2=rest
  146.                   if (keyword == 'GENDER') then gender=rest
  147.                   if (keyword == 'STARTTIME') then starttime=rest
  148.                   if (keyword == 'ENDTIME') then endtime=rest
  149.  
  150.                   if (keyword == 'MINONLINETIME') then mintime=rest
  151.                   if (keyword == 'MAXONLINETIME') then maxtime=rest
  152.  
  153.  
  154.                   if (keyword == 'MINCALLS') then mincalls=rest
  155.                   if (keyword == 'MAXCALLS') then maxcalls=rest
  156.  
  157.                   if (keyword == 'MINPOSTS') then minposts=rest
  158.                   if (keyword == 'MAXPOSTS') then maxposts=rest
  159.                   if (keyword == 'MINUPLOADS') then minuploads=rest
  160.                   if (keyword == 'MAXUPLOADS') then maxuploads=rest
  161.                   if (keyword == 'MINDOWNLOADS') then mindownloads=rest
  162.                   if (keyword == 'MAXDOWNLOADS') then maxdownloads=rest
  163.                   if (keyword == 'GROUP') then group=rest
  164.                   if (keyword == 'PORTFLAGS') then portflags=rest
  165.  
  166.           mincredit=''
  167.           maxcredit=''
  168.  
  169.                   if (keyword == 'ENDMENUITEM') then do
  170.              line=key','menucommand','displaystring','dataoption','displaycolor','minage','maxage','
  171.              line=line||sec1','sec2','flags1','flags2','starttime','endtime','gender','mincredit','
  172.                    line=line||maxcredit','mintime','maxtime','mincall','maxcall','minposts','maxposts','
  173.              line=line||minuploads','maxuploads','mindownloads','maxdownloads','group','portflags
  174.              line=strip(line, 'T',',')
  175.                      RC = LineOut(NewName, line)
  176.               key =''
  177.               menucommand =''
  178.               displaystring =''
  179.               displaycolor =''
  180.                       DATAOPTION =''
  181.                       MINAGE =''
  182.                       MAXAGE =''
  183.                       SEC1 =''
  184.                       SEC2 =''
  185.                       FLAGS1 =''
  186.                       FLAGS2 =''
  187.                       GENDER =''
  188.                       STARTTIME =''
  189.                       ENDTIME =''
  190.                       MINTIME =''
  191.                       MAXTIME =''
  192.                       MINCALL =''
  193.                       MAXCALL =''
  194.                       MINPOSTS =''
  195.                       MAXPOSTS =''
  196.                       MINUPLOADS =''
  197.                       MAXUPLOADS =''
  198.                       MINDOWNLOADS =''
  199.                       MAXDOWNLOADS =''
  200.                       GROUP =''
  201.                       PORTFLAGS =''
  202.               line=''
  203.               end                               /* Ende ENDMENUITEM */
  204.             end                                     /* Schleife einlesen und abfrage ende */
  205.  
  206.         ret = STREAM( (file) , "C" , "CLOSE" )
  207.         ret = STREAM( (newname) , "C" , "CLOSE" )
  208.  
  209.             AdCmd = 'Ren ' || OldName || ' ' || NewOld
  210.             AdCmd
  211.             AdCmd = 'Ren ' || NewName || ' ' || OldName
  212.             AdCmd
  213.  
  214. end                             /* ende stem schleife */
  215.  
  216. Call Directory(OldDirectory)
  217. say ''
  218. say ' ==========================================================================='
  219. Say ' 'fline.0' 1.08-Menus found and 'counter' menus converted into 1.07 menu structure, Done..'
  220. say ''
  221. say ' Renaming 108-menus -> *.menu.old    Renaming *.menu.new -> *.menu '
  222.  
  223. exit
  224.  
  225. CLEANUP:
  226. exit
  227.