/* Begin Folder/Icon Creator for AdeptXBBS */
trace on
'@Echo off'
adummy = ''
say '[0m[2J'
adummy = ''
say '[0m[2J'
say ''
say ''
say ''
say 'This little script does not install Adeptxbbs for you, what it does do  '
say ' is create an Adept Folder and icons for you on your Desktop.          '
say ' And gives you the option of configuring a 2 node version             '
say ' of AdeptXbbs. '
say ''
dummy = charout(,'Do you wish to continue with this process ? [y/N] ')
parse upper pull adummy
if left(adummy,1) \= 'Y' then do
  exit
end

curdir = directory()

do
    say ''
    say 'Please enter the drive letter AdeptXBBS is installed on (Ex. C:)'
    say 'You MUST enter the full drive letter, C: <- Notice the colon'
    say '--'
    parse upper pull dummy
    ADDRESS CMD dummy
    ADDRESS CMD "CD\"
    ADDRESS CMD "CD ADEPT"
    olddir = curdir
    curdir = dummy'\ADEPT'
    say ''
    say 'Current sub-directory: 'curdir
    say ''
    say 'Is this the Directory AdeptXBBS is installed in ?'
    dum = charout(, 'sub-directory? [Y/n] ')
    parse upper pull dummy
    if left(dummy,1) = 'N' then do
    say 'Folder Creation aborted...'
    exit
    end

    say ''
end

/* load rexx utility functions */

rc = stream('adept.exe','c','query exists')
if rc = '' then
do
  say 'Sorry, ADEPT.EXE not found.  Must not be right directory. Terminating.'
  exit
end

say ''
say 'If you see any SYS### errors from this point on, please ignore them'
say ''
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

/* say it, then do it */

say "Creating AdeptXbbs folder..."

/* first, create AdeptSoft folder */

title = "AdeptXbbs"
classname = 'WPFolder'
location = '<WP_DESKTOP>'
setup = 'OBJECTID=<AdeptXbbs_Folder>;OPEN=DEFAULT'
result=SysCreateObject(classname,title,location,setup,f)

/* If folder exists, ask before updating */

if result = 0 then
do
  existed = 'TRUE'
  say ''
  say 'The AdeptXBBS folder already exists.'
  dum = Charout(, 'Do you really want to create a duplicate? [Y/n] ')
  parse upper pull dummy
  if left(dummy,1) = 'N' then
  do
      say 'Folder Creation Aborted.. Exiting... '
      exit
    end
say "Creating objects in AdeptSoft folder..."

/* now, create program objects in AdeptSoft folder */

title = "AdeptXBBS 1 Node"
classname = 'WPProgram'
location = '<AdeptXbbs_Folder>'
setup = 'EXENAME='curdir'\ADEPT.EXE;STARTUPDIR='curdir';PARAMETERS=/NODES 1'
call SysCreateObject classname,title,location,setup,u

title = "AdeptXBBS 2 Nodes"
classname = 'WPProgram'
location = '<AdeptXbbs_Folder>'
setup = 'EXENAME='curdir'\ADEPT.EXE;STARTUPDIR='curdir';PARAMETERS=/NODES 2'
call SysCreateObject classname,title,location,setup,u

title = "AdeptXBBS in Setup Mode"
classname = 'WPProgram'
location = '<AdeptXbbs_Folder>'
setup = 'EXENAME='curdir'\ADEPT.EXE;STARTUPDIR='curdir';PARAMETERS=/NODES 2 /SETUP'
call SysCreateObject classname,title,location,setup,u

rc = stream('xsend.cmd','c','query exists')
if rc \= '' then
do
  title = "Send files"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
  setup = 'EXENAME='curdir'\XSEND.CMD;STARTUPDIR='curdir
  if existed = '' then setup = setup';PARAMETERS=%* 'curdir'\\'
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('fileedit.exe','c','query exists')
if rc \= '' then
do
  title = "File area editor"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
  setup = 'EXENAME='curdir'\FILEEDIT.EXE;STARTUPDIR='curdir
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('mail.cmd','c','query exists')
if rc \= '' then
do
  title = "Process mail"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
  setup = 'EXENAME='curdir'\mail.cmd;STARTUPDIR='curdir
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('reindexfiles.exe','c','query exists')
if rc \= '' then
do
  title = "Reindex File Database"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
  setup = 'EXENAME='curdir'\ReIndexFiles.EXE;STARTUPDIR='curdir';PARAMETERS=/NUKE'
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('reindexusers.exe','c','query exists')
if rc \= '' then
do
  title = "Reindex User File"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
setup = 'EXENAME='curdir'\ReIndexUsers.Exe;STARTUPDIR='curdir
call SysCreateObject classname,title,location,setup,u
end

rc = stream('bfsmake.exe','c','query exists')
if rc \= '' then
do
  title = "Convert file areas"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
  setup = 'EXENAME='curdir'\BFSMAKE.EXE;STARTUPDIR='curdir
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('xmsg.cmd','c','query exists')
if rc \= '' then
do
  title = "Clean up msg areas"
  classname = 'WPProgram'
  location = '<AdeptXbbs_Folder>'
  setup = 'EXENAME='curdir'\CLEAN.EXE;STARTUPDIR='curdir
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('AdpXBBS.DOC','c','query exists')
if rc \= '' then
do
  title = "AdeptXBBS Documentation!"
  classname = 'WPShadow'
  location = '<AdeptXbbs_Folder>'
  setup = 'SHADOWID='rc
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('GATEKPR.DOC','c','query exists')
if rc \= '' then
do
  title = "Gate Keeper Documentation!"
  classname = 'WPShadow'
  location = '<AdeptXbbs_Folder>'
  setup = 'SHADOWID='rc
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('AdpRexx.DOC','c','query exists')
if rc \= '' then
do
  title = "AdeptREXX Documentation!"
  classname = 'WPShadow'
  location = '<AdeptXbbs_Folder>'
  setup = 'SHADOWID='rc
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('UserMod.Doc','c','query exists')
if rc \= '' then
do
  title = "Batch User Modifier"
  classname = 'WPShadow'
  location = '<AdeptXbbs_Folder>'
  setup = 'SHADOWID='rc
  call SysCreateObject classname,title,location,setup,u
end

rc = stream('FAQ12-95.TXT','c','query exists')
if rc \= '' then
do
  title = "AdeptXBBS Frequently Asked Questions"
  classname = 'WPShadow'
  location = '<AdeptXbbs_Folder>'
  setup = 'SHADOWID='rc
  call SysCreateObject classname,title,location,setup,u
end

  rc = directory('Menus')
  if rc \= '' then
  do
    call directory curdir
    title = "BBS Menus"
    classname = 'WPShadow'
    location = '<AdeptXbbs_Folder>'
    setup = 'SHADOWID='rc
    call SysCreateObject classname,title,location,setup,u
  end

  rc = directory('Text')
  if rc \= '' then
  do
    call directory curdir
    title = "BBS Text"
    classname = 'WPShadow'
    location = '<AdeptXBBS_Folder>'
    setup = 'SHADOWID='rc
    call SysCreateObject classname,title,location,setup,u
  end

  rc = directory('System\SysNews')
  if rc \= '' then
  do
    call directory curdir
    title = "BBS System News"
    classname = 'WPShadow'
    location = '<AdeptXbbs_Folder>'
    setup = 'SHADOWID='rc
    call SysCreateObject classname,title,location,setup,u
  end

  rc = directory('System\MiscNews')
  if rc \= '' then
  do
    call directory curdir
    title = "BBS Misc. News"
    classname = 'WPShadow'
    location = '<AdeptXbbs_Folder>'
    setup = 'SHADOWID='rc
    call SysCreateObject classname,title,location,setup,u
  end

rc = stream('Adept.HLP','c','query exists')
if rc \= '' then
do
  rc = stream('SEEHELP.EXE','c','query exists')
  if rc \= '' then
  do
    title = "AdeptXBBS Online Help"
    classname = 'WPProgram'
    location = '<AdeptXbbs_Folder>'
    setup = 'EXENAME='curdir'\SEEHELP.EXE;'
    setup = setup'STARTDIR='curdir';PARAMETERS='curdir'\ADEPT.HLP'
    call SysCreateObject classname,title,location,setup,f
  end
end

do
  say ''
  say 'Folder Creation appears to have been sucessful!'
  say ''
end

do
  say ''
  say 'NOTE: This setup defaults to starting 2 nodes.  Both nodes will be'
  say '      started in  "'"SETUP"'"  mode.  This is to be sure that it will'
  say '      not interupt anything else that is running.'
  say ''
  say '      You can setup the BBSs options from the Config pull down on'
  say '      the main screen.'
  say ''
  say '      Be sure to click on Shutdown in order to make sure your settings'
  say '      are properly saved.'
  say ''
  say ''
  say 'Would you like to setup your copy of'
  dum = Charout(, 'AdeptXBBS? [y/N] ')
  parse upper pull dummy
  if left(dummy,1) = 'Y' then
  do
    ADDRESS CMD 'Adept.exe /NODES 2 /SETUP'
  end
  say ''

end

say 'Thank you for choosing AdeptXbbs, The All round Best OS/2 BBs!'
end
/* END Install Program */
