/* Lad.rexx                                   C. Larcombe
   Point-and-shoot .lzh file creator
   Requires WSHell 1.02 and ARexx 1.10 both by W.S.Hawes
   Requires ClockDJ 5.02 by David Jenkins
   Written to use ClockDJ + CedExtendedRequester 29/12/90
   Modified to use ClockDJ 5.02 or later         04/01/91
*/

Options results
Parse arg Order
Parse Source FileSource
Long  = Word(FileSource , 4)
Short = translate(Long , "  " , ":/")
Short = word(short , words(short))
If Order = '?' then call help
Temp  = "Ram:$$" || short
If order >'' then do
  Parse var Order input ' ' lzfile
  If right(lzfile,2) = '/*' then do
    lzfile = left(lzfile,length(lzfile)-1))
    trail = '*'
    end
  Else Trail = ''
  Call ExecuteIt
  Exit
End

Dir = 'Vd0:'
  Address 'CLOCKDJ'
  'SETCEDTITLE'  ' SHIFT-SELECT items to add  '
  'SETCEDDIRCOLOUR'    '2'
  'SETCEDFILECOLOUR'   '1'
  'SETCEDDEVCOLOUR'    '3'
  'SETCEDLINES'       '40'
  'SETCEDFILECOLS'    '24'
  'SETCEDDEVCOLS'     '18'
  'SETCEDBOXCOLOUR'   '3'
  'SETCEDDIR'  Dir
  'SETCEDFILE' ' '
  'CEDEXTENDEDREQUESTER'
  Input = result
  If Input = "" then EXIT
  if index(Input,'0a'x) = 0 then Input = overlay('*',Input,length(Input),1)
  Input = Translate(Input, ' ', '0a 'x)
  Segment = Word(Input,1)
  Drive = Left(SEGMENT,pos(':',SEGMENT))
  If (right(Input,1)='/') | (right(Input,1)=':') then,
     Trail = '*'
  Else Trail = ''
  If Pos('/',SEGMENT) >0 then,
    Dir = Left(SEGMENT,lastpos('/',SEGMENT)-1)
  Else
    Dir = Left(SEGMENT,pos(':',SEGMENT))
  'SETCEDTITLE'  ' Select Destination File  '
  'SETCEDDIRCOLOUR'    '2'
  'SETCEDFILECOLOUR'   '1'
  'SETCEDDEVCOLOUR'    '3'
  'SETCEDLINES'       '40'
  'SETCEDFILECOLS'    '24'
  'SETCEDDEVCOLS'     '24'
  'SETCEDBOXCOLOUR'   '1'
  'SETCEDDIR'  'Vd0:'
  'SETCEDFILE' ''
  'CEDREQUESTER'
  Lzfile = result
  If Lzfile = "" then EXIT
  Address
  Call ExecuteIt
  address clockdj
  'SETCEDDIRCOLOUR'    '2'
  'SETCEDFILECOLOUR'   '1'
  'SETCEDDEVCOLOUR'    '2'
  'SETCEDLINES'       '38'
  'SETCEDFILECOLS'    '28'
  'SETCEDDEVCOLS'     '14'
  'SETCEDBOXCOLOUR'   '3'
EXIT

ExecuteIt:
  Call open Mine, Temp , w
  Call Writeln mine, 'lharc -r -x a ' Lzfile Input || trail
  Call WriteLn Mine, 'lharc l' lzfile
  Call WriteLn mine, 'Pause "Finished: Hit a key"'
  Call WriteLn mine, 'EndCLI'
  Call Close Mine
  'NewWsh "CON:S**/10/10/640/280/ 'short' Information Window/" from' Temp
  Do while exists(Temp)
    Call Delete(Temp)
  end
Return

Help:
Say "    This Arexx macro is" Long
Say "    Use "short" <file>  <dest> to LZ add a file to dest.lzh "
Say "        "short" <dir>/* <dest> to LZ add a dir  to dest.lzh "
Say "        "short"                for file requester."
Say ""
ExExe