home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / wcst2url.zip / createFolder.cmd next >
OS/2 REXX Batch file  |  1998-01-01  |  5KB  |  181 lines

  1. /*
  2.  *
  3.  * createFOLDER v1.0 - Dec. 1997
  4.  * Simple script which creates two folders for NEW and UPDATED
  5.  * links from Warpcast and then shadows them on the WPS.
  6.  *
  7.  * G.Aprile A.Resmini and P.Rossi
  8.  * You may get in touch with A.Resmini at resmini@netsis.it
  9.  *
  10.  * Needless to say, this is absolutely FREEWARE, comes with no
  11.  * warranties whatsoever, and does not work in Windows.
  12.  * Actually, you would need some 10MBs program to do this, in Windows.
  13.  * ;)
  14.  *
  15.  * G.Aprile and A.Resmini are members of teamOS2 Italy
  16.  *
  17.  *
  18.  * The script will let you choose drive and directory names.
  19.  * If you do not specify them it will default to the OS/2 system drive
  20.  * and to [Warpcast New Links] and [Warpcast Updated Links].
  21.  *
  22.  *
  23.  *
  24.  */
  25.  
  26.     call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  27.     call SysLoadFuncs
  28.  
  29.     newFolder= '[Warpcast New links]'
  30.     updFolder= '[Warpcast Updated links]'
  31.  
  32.     aesc='1B'x
  33.     yellow=aesc||'[33;m'
  34.     red=aesc||'[31;m'
  35.     white=aesc||'[37;m'
  36.     green=aesc||'[32;m'
  37.     bright=aesc||'[1;m'
  38.     dull=aesc||'[2;m'
  39.     normal=aesc||'[0;m'
  40.     bold=aesc||'[1;m'
  41.  
  42.     '@cls'
  43.     '@Ansi >ansitemp.$$$$$'
  44.  
  45.     AnsiStatus = Right(Linein('ansitemp.$$$$$'), 3)
  46.     err = stream('ansitemp.$$$$$','c','close')
  47.     '@del ansitemp.$$$$$'
  48.     if AnsiStatus = 'ff.' then '@Ansi on'
  49.  
  50.     say ' '
  51.     say bright yellow '   createFOLDER v1.0 - December 1997' normal
  52.     say ' '
  53.     say ' This script will create folders for Warpcast URLs on a selected'
  54.     say ' hard disk and then it will shadow them on your Workplace Shell.'
  55.     say ' '
  56.  
  57.     say bright yellow ' Enter drive for the NEW Sites folder or ENTER for boot drive'
  58.     call CharOut , '   ==> ' normal
  59.      parse pull new
  60.  
  61.       if new = '' then new = Left(SysSearchPath('PATH','CMD.EXE') , 1 )
  62.       newDrive = left( new, 1)
  63.  
  64.     say bright yellow ' Enter drive for the UPDATED Sites folder or ENTER for boot drive'
  65.     call CharOut , '   ==> ' normal
  66.      parse pull upd
  67.  
  68.      if upd = '' then upd = Left(SysSearchPath('PATH','CMD.EXE') , 1 )
  69.      updDrive = left( upd, 1)
  70.  
  71.     say  bright yellow ' Enter the NEW URLs dirname or press ENTER for [Warpcast New Links]'
  72.     call CharOut , '   ==> ' normal
  73.      parse pull newPull
  74.  
  75.      if newPull = '' then
  76.         newPull = newFolder
  77.  
  78.     say bright yellow ' Enter the UPDATED URLs dirname or press ENTER for [Warpcast Updated Links]'
  79.     call CharOut , '   ==> ' normal
  80.      parse pull updPull
  81.  
  82.      if updPull = '' then updPull = updFolder
  83.  
  84.      newDir = newDrive || ':\' || newPull
  85.      updDir = updDrive || ':\' || updPull
  86.  
  87.     objectIDN  = '<WCASTNEW>'
  88.         title  = newFolder
  89.     className  = 'WPFolder'
  90.      location  =  newDrive || ':\'
  91.         setup  = 'OBJECTID=' || objectIDN || ';'
  92.     UpdateFlag = 'F'
  93.  
  94.     rc = SysCreateObject( className, title, location, setup, updateFlag )
  95.     if rc <> 1 then
  96.     do
  97.       say bright red ' '
  98.       say ' Whoops, could not create ' || title '.' || '07'x
  99.       say ' Either the folder already exists or an error occurred.'
  100.       say ' ' normal
  101.     end
  102.     else
  103.  
  104.     objectIDU  = '<WCASTUPD>'
  105.         title  = updFolder
  106.     className  = 'WPFolder'
  107.      location  =  updDrive || ':\'
  108.         setup  = 'OBJECTID=' || objectIDU || ';'
  109.     UpdateFlag = 'F'
  110.  
  111.     rc = SysCreateObject( className, title, location, setup, updateFlag )
  112.     if rc <> 1 then
  113.     do
  114.       say bright red ' '
  115.       say ' Whoops, could not create ' || title '.' || '07'x
  116.       say ' Either the folder already exists or an error occurred.'
  117.       say ' ' normal
  118.     end
  119.     else
  120.  
  121.  /* A dummy title string to pass to SysCreateObject */
  122.  
  123.     title = 'faketitle'
  124.  
  125.  /* Now let's create them shadows*/
  126.  
  127.      className = 'WPShadow'
  128.       location = '<WP_DESKTOP>'
  129.          setup = 'SHADOWID= <WCASTNEW>'
  130.     UpdateFlag = 'F'
  131.  
  132.     rc = SysCreateObject( className, title, location, setup, updateFlag )
  133.     if rc <> 1 then
  134.     do
  135.       say bright red ' '
  136.       say ' Oops, could not create the shadow for the NEW folder.' || '07'x
  137.       say ' Either the object already exists or an error occurred.'
  138.       say ' ' normal
  139.     end
  140.     else
  141.  
  142.     className  = 'WPShadow'
  143.      location  = '<WP_DESKTOP>'
  144.         setup  = 'SHADOWID= <WCASTUPD>'
  145.     UpdateFlag = 'F'
  146.  
  147.     rc = SysCreateObject( className, title, location, setup , updateFlag )
  148.     if rc <> 1 then
  149.     do
  150.       say bright red ' '
  151.       say ' Oops, could not create the shadow for the UPDATED folder.' || '07'x
  152.       say ' Either the object already exists or an error occurred.'
  153.       say ' ' normal
  154.     end
  155.  
  156.   /*
  157.    * In order to complete installation, ask the user if he/she/it wants
  158.    * an object on the WPS for the rexx script HTMLBuilder.
  159.    */
  160.  
  161.     say bright yellow ' Would you like to have an object for HTMLBuilder on your WPS (Y/N)?'
  162.     call CharOut , '   ==> ' normal
  163.  
  164.     answer = Translate( CharIn() )
  165.       if answer =  'Y' then  call makeObj
  166.     
  167.     say bright green ' '
  168.     say ' All done. Enjoy.' normal
  169.  
  170.     if AnsiStatus = 'ff.' then '@Ansi off'
  171.     call SysDropFuncs
  172.     exit
  173.  
  174.  /* This is the function the creates the HTMLBuilder WPS object. Nothing new. */
  175.  
  176.     makeOBJ:
  177.  
  178.      dir = directory() || '\'
  179.      rc=SysCreateObject('WPProgram', 'HTMLBuilder', '<WP_DESKTOP>','EXENAME=' || dir || 'HTMLBuilder.cmd;STARTUPDIR=' || dir )
  180.     return
  181.