/* AUTOcmd [0.0.8] for WVware */
/****************************/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
parse arg curdir filename

  /* (C) TEAM OS/2 Russia, http://teamos2.ru, mail@teamos2.ru */
 /************************************************************/
/* SEEEEEEEEEEE wvWare.config for config ********************/


   cfgname=curdir'\wvWare.config'

   configdate=stream(cfgname,'c',query datetime)
   do while lines(cfgname)
     inli=linein(cfgname)
     parse value inli with cfgvar"='"cfgvarvalue"'"
     if (cfgvar\="")&(cfgvarvalue\="") then do
       interpret cfgvar"='"cfgvarvalue"'"
     end
   end



/* and these lines are for me ;) */
if configured\='YES' then do;say'';say'';say'';say '[41m[1m please CONFIGURE wvWare.config! [0m';'@pause >nul';exit;end
/*curdir=directory()*/
if outdir\=directory(outdir) then call SysMkDir outdir
call directory curdir
if filename='' then do; say 'Usage: wvWare filename.doc';exit;end

tempname=filename
diskname=substr(tempname,1,lastpos(':',tempname)-1)
tempname=substr(tempname,lastpos('\',tempname)+1)
dirname=substr(tempname,1,lastpos('.',tempname)-1)
extname=substr(tempname,lastpos('.',tempname)+1)
dirrname=outdir'\'dirname

say ''
say ''
say ' [36m[42m[1m autoCMD adapted for wvWare [0m'
say ''
call SysMkDir dirrname
call directory dirrname
'@copy 'filename' 'dirrname'\'dirname'.'extname '>nul'

call charout STDOUT,'[46m[33m[1m converting.... [0m'


'@'wvexedir'\wvware.exe '/* --config /usr/local/lib/wv/config.xml */' '/*--charset koi8-r*/' 'dirname'.'extname' >'dirname'.html 2>'dirname'.log'

say '[46m[33m[1m ....done [0m'


say ''
say ''
say ''
say 'your [32m[1mSOURCE[0m file has been dublicated in directory'
say ' [42m[1m 'dirrname' [0m'
say ' [32m[1mLOG[0m file is'
say ' [42m[1m 'dirrname'\'dirname'.log [0m'
say 'your [32m[1mCONVERTED[0m files are in'
say ' [42m[1m 'dirrname' [0m'
say 'your [32m[1mCONVERTED INDEX[0m file is'
say ' [42m[1m 'dirrname'\'dirname'.html [0m'
say ''

if launchNETSCAPE=='YES' then do
  say 'launching NETscape in 3 seconds. press ctrl-c if you don`t this'
  call syssleep 3
  'start netscape.exe 'dirrname'\'dirname'.html'
end
else say 'if you want NETscape launches automatically please edit file wvWare.config'
say ''
say '[5m This window will close itself in 17 seconds '
say ' If you don`t this  [1mMARK TEXT[0m[5m in this window now  or  [1mpress PAUSE button [0m'
say ''


/* ogho! nice joke ;) */
hoho.0=14
hoho.1='Û'
hoho.2='Û'
hoho.3='Û'
hoho.4='Û'
hoho.5=' '
hoho.6='O'
hoho.7='S'
hoho.8='/'
hoho.9='2'
hoho.10=' '
hoho.11='W'
hoho.12='a'
hoho.13='r'
hoho.14='p'

do i=1 to hoho.0
 call charout STDOUT,hoho.i
 call syssleep 1
end

call sysSleep 3
