home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 February / SOFM_Feb1995.bin / pc / os2 / easylo / setup.cmd < prev   
OS/2 REXX Batch file  |  1994-09-28  |  8KB  |  291 lines

  1. /* rexx */
  2. /*
  3. ========================================================================
  4.  
  5. ------------------------------- SETUP ----------------------------------
  6.  
  7.                          easyLOOK Setup Module
  8.  
  9.                 Copyright (C) 1994 Global Automation Co.
  10.                           All Rights Reserved
  11.  
  12.                          Simon Husin Production
  13.  
  14.  
  15. -------------------------- S H A R E W A R E ---------------------------
  16.  
  17. ========================================================================
  18.  
  19. To execute:
  20.  
  21.    Improved GUI/OOUI Approach:
  22.        Double-click the drives icon (and subsequent folders) to get to
  23.        see easyLOOK files, and double-click on SETUP icon.
  24.  
  25.    Command driven:
  26.        Type SETUP from an OS/2 prompt with the current directory set to
  27.        where this and easyLOOK.EXI/.EXQ files reside, then press Enter.
  28.  
  29. ------------------------------------------------------------------------
  30. */
  31.  
  32. '@echo off'
  33. /*
  34. Register IBM OS/2 RexxUtil Functions
  35. */
  36. if rxfuncquery('sysloadfuncs') then do
  37.    call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  38.    call sysloadfuncs
  39.    end
  40.  
  41. do until result = 0 | result = -1
  42.    call DeterminePath
  43.    end
  44. if result = -1 then call SetupTermination
  45.  
  46. call DetermineInterpreter
  47.  
  48. call CreateeasyLOOKObject
  49.  
  50. call DisplayLicense
  51.  
  52. call Completion
  53.  
  54. return 0
  55.  
  56.  
  57.  
  58. CreateeasyLOOKObject: procedure
  59. /*
  60. ------------------------------------------------------------------------
  61. Create or replace easyLOOK object on the desktop
  62. ------------------------------------------------------------------------
  63. */
  64.  
  65. call DisplayCopyright
  66. say 'Creating easyLOOK object on the desktop...'
  67.  
  68. call SysSetIcon 'easyLOOK.EXE', 'easyLOOK.ICO'
  69.  
  70. startupdir = syssearchpath('PATH', 'easyLOOK.EXE')
  71. startupdir = left(startupdir, length(startupdir) - 12)
  72.  
  73. if right(startupdir, 1) = '\' then
  74.    execprog = startupdir'easyLOOK.EXE'
  75. else
  76.    execprog = startupdir'\easyLOOK.EXE'
  77.  
  78. classname='WPProgram'                /* to be used as a program */
  79. title='easy' || x2c('0A') || 'LOOK'  /* title */
  80. location='<WP_DESKTOP>'              /* place it on OS/2 DESKTOP*/
  81. setup='OBJECTID=<easyLOOK>;'     ||, /* other settings */
  82.       'EXENAME='execprog';'      ||,
  83.       'STARTUPDIR='startupdir';' ||,
  84.       'PROGTYPE=OS2WINDOW;'      ||,
  85.       'MINIMIZED=;'              ||,
  86.       'MAXIMIZED=;'              ||,
  87.       'PARAMETERS=%*;'           ||,
  88.       'NOAUTOCLOSE=;'            ||,
  89.       'CCVIEW=YES;'              ||,
  90.       'ASSOCTYPE=Plain Text,,;'  ||,
  91.       'ASSOCFILTER=*.ELP,,;'
  92. call SysCreateObject classname, title, location, setup, 'REPLACE'
  93.  
  94. return result
  95.  
  96.  
  97.  
  98. Completion: procedure
  99. /*
  100. ------------------------------------------------------------------------
  101. Installation completion screen
  102. ------------------------------------------------------------------------
  103. */
  104. call DisplayCopyright
  105.  
  106. say 'easyLOOK installation has been completed!'
  107. say
  108. say 'easyLOOK Icon has been created on your OS/2 Desktop.'
  109. say
  110. say 'Please read files LICENSE.TXT for license agreement, and'
  111. say 'easyLOOK.DOC for a complete documentation.'
  112. say
  113. say 'Thank you for using easyLOOK.'
  114. say
  115. say 'Simon Husin'
  116. say 'Global Automation Co.'
  117. say copies('_', 78)
  118. say
  119. say 'Type Y to read easyLOOK.DOC now, or any other key to quit'
  120. choice = translate(sysgetkey('NOECHO')); say choice
  121. if choice = 'Y' then 'E easyLOOK.DOC'
  122. return 0
  123.  
  124.  
  125.  
  126. DeterminePath: procedure
  127. /*
  128. ------------------------------------------------------------------------
  129. Request for drive and path (if not on hard disk)
  130. ------------------------------------------------------------------------
  131. */
  132.  
  133. call DisplayCopyright
  134. parse source . . cursource
  135. cursource = translate(cursource)
  136. curset = filespec('DRIVE', cursource) || filespec('PATH', cursource)
  137. say 'easyLOOK files found in' curset'...'
  138. say 'Do you want to keep them there?  Type Y to confirm.'
  139. choices = 'Y'
  140. say
  141. drives = translate(sysdrivemap('A:'), ' ', ':')
  142. drives = translate(drives, '    ', 'ABQY')
  143. if filespec('PATH', cursource) = '\EASYLOOK\' &,
  144.    pos(left(curset, 1), drives) > 0 then
  145.    drives = translate(drives, ' ', left(curset, 1))
  146. choices = choices || space(drives, 0)'Q'
  147. if strip(drives) \= '' then do
  148.    say 'Otherwise, please type one of the following drives found on'
  149.    say 'your system.  If you choose one of these drives, SETUP will'
  150.    say 'create and place all files in directory \EASYLOOK\.'
  151.    say
  152.    blanks = copies(' ', 78)
  153.    say '   Drive  Label        Bytes Avail.   % Avail'
  154.    do i = 1 to words(drives)
  155.       dl = word(drives, i)
  156.       parse value sysdriveinfo(dl':') with . dif dit dil
  157.       if dif < 720000 then iterate
  158.       sl = overlay(dl, blanks, 6)
  159.       sl = overlay(strip(dil), sl, 11)
  160.       sl = overlay(format(dif, 12), sl, 24)
  161.       sl = overlay(format(dif/dit*100, 3, 2), sl, 40)
  162.       say sl
  163.       end
  164.    end
  165. say
  166. call charout 'CON', 'Your choice (or Q to quit): '
  167. choice = translate(sysgetkey('NOECHO'))
  168. say choice
  169.  
  170. if pos(choice, choices) = 0 then return 1
  171. if choice = 'Q' then return -1
  172. if choice = 'Y' then return 0
  173.  
  174. say
  175. newset = choice':\EASYLOOK'
  176. say 'Creating' newset'...'
  177. call sysmkdir newset
  178. if result = 0 | result = 5 then do
  179.    say 'Copying files to' newset'...'
  180.    '@copy *.*' newset
  181.    choice':'
  182.    '@cd\easylook'
  183.    return 0
  184.    end
  185.  
  186. select
  187.    when result = 0 then say 'Directory creation was successful'
  188.    when result = 2 then say 'File not found'
  189.    when result = 3 then say 'Path not found'
  190.    when result = 5 then say 'Access denied'
  191.    when result = 26 then say 'Not a DOS disk'
  192.    when result = 87 then say 'Invalid parameter'
  193.    when result = 108 then say 'Drive locked'
  194.    when result = 206 then say 'Filename exceeds range'
  195.    otherwise              say 'Unknown error detected!'
  196.    end
  197. return -1
  198.  
  199.  
  200.  
  201. DisplayCopyright: procedure
  202. /*
  203. ------------------------------------------------------------------------
  204. Display copyright information
  205. ------------------------------------------------------------------------
  206. */
  207. 'cls'
  208. say
  209. say 'SETUP --- easyLOOK Set up program'
  210. say 'Copyright (C) 1994 Global Automation Co.'
  211. say 'All Rights Reserved'
  212. say copies('_', 78)
  213. return 0
  214.  
  215.  
  216.  
  217. DisplayLicense: procedure
  218. /*
  219. ------------------------------------------------------------------------
  220. Display copyright information
  221. ------------------------------------------------------------------------
  222. */
  223. call DisplayCopyright
  224. say 'Displaying License Information...'
  225. Call SysSetObjectData '<easyLOOK>', 'PARAMETERS=LICENSE;OPEN=DEFAULT;'
  226. Call SysSetObjectData '<easyLOOK>', 'PARAMETERS=%*;'
  227. call syssleep 10
  228. return 0
  229.  
  230.  
  231. SetupTermination: procedure
  232. /*
  233. ------------------------------------------------------------------------
  234. Termination screen
  235. ------------------------------------------------------------------------
  236. */
  237. say
  238. say 'easyLOOK installation has been abrupted!'
  239. say
  240. say 'Thank you for considering installing easyLOOK.'
  241. say
  242. say 'Simon Husin'
  243. say 'Global Automation Co.'
  244. say copies('_', 78)
  245. say
  246. say 'Type any key to close this task now...'
  247. call sysgetkey 'NOECHO'
  248. exit -1
  249.  
  250.  
  251.  
  252. DetermineInterpreter: procedure
  253. /*
  254. ------------------------------------------------------------------------
  255. Determine interpreter being used & install the fastest easyLOOK for it
  256. ------------------------------------------------------------------------
  257. */
  258.  
  259. call DisplayCopyright
  260. say 'Checking for the REXX engine currently used...'
  261. say 'Install the best easyLOOK version for it.'
  262. say
  263.  
  264. startupdir = syssearchpath('PATH', 'easyLOOK.DOC')
  265. startupdir = left(startupdir, length(startupdir) - 12)
  266.  
  267. if right(startupdir, 1) = '\' then do
  268.    sourceprog = startupdir'easyLOOK.EX'
  269.    targetprog = startupdir'easyLOOK.EXE'
  270.    end
  271. else do
  272.    sourceprog = startupdir'\easyLOOK.EX'
  273.    targetprog = startupdir'\easyLOOK.EXE'
  274.    end
  275.  
  276. parse version interpreter .
  277. interpreter = translate(interpreter)
  278. if interpreter = 'REXX/PERSONAL' then do
  279.    say 'Optimizing easyLOOK for Quercus Personal/REXX...'
  280.    sourceprog = sourceprog'Q'  /* Quercus Personal/REXX */
  281.    end
  282. else do
  283.    say 'Optimizing easyLOOK for IBM OS/2 PL/2 REXX...'
  284.    sourceprog = sourceprog'I'  /* IBM OS/2 PL/2 REXX */
  285.    end
  286.  
  287. '@copy' sourceprog targetprog '>NUL'
  288. call syssleep 4
  289.  
  290. return 0
  291.