home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / keybset.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1995-03-29  |  3KB  |  96 lines

  1. /***************************************************************************\
  2. * install.cmd - this installs the ShiftLock fix               950329
  3. *
  4. * Copyright (c) 1995 Martin Lafaix. All Rights Reserved.
  5. \***************************************************************************/
  6.  
  7. '@cls'; signal on halt; trace off
  8.  
  9. /* Load the RexxUtil functions */
  10. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  11. Call SysLoadFuncs
  12.  
  13. /* Initialisation */
  14. exename = SysSearchPath("PATH","SL.EXE")
  15. startupdir = SysSearchPath("PATH", "SLHOOK.DLL")
  16.  
  17. say 'This script will install a Program Object for ShiftLock in your'
  18. say 'Startup folder.'
  19. say
  20. say '(Use Ctrl+C to stop the installation.)'
  21. say
  22. say 'Source path of ShiftLock (SL.EXE) :' exename
  23.  
  24. /* Read the SL.EXE path */
  25. if isnotcorrect() then exename = getname("SL.EXE")
  26. if translate(right(exename,6)) \= "SL.EXE" then
  27.    if right(exename,1) = "\" then
  28.       exename = exename"SL.EXE"
  29.    else
  30.       exename = exexname"\SL.EXE"
  31.  
  32. say
  33. say 'Source path of the ShiftLock DLL (SLHOOK.DLL) :' startupdir
  34.  
  35. /* Read the SLHOOK path */
  36. if isnotcorrect() then startupdir = getname("SLHOOK.DLL")
  37. if translate(right(startupdir,10)) = "SLHOOK.DLL" then
  38.    startupdir = left(startupdir, length(startupdir)-10)
  39. if right(startupdir,1) = "\" then
  40.    startupdir = left(startupdir,length(startupdir)-1)
  41.  
  42. /* Create the program object */
  43. say
  44. say 'Creating a program object:'
  45. say
  46. say '          Class = WPProgram'
  47. say '           Name = ShiftLock'
  48. say '    Destination = <WP_START>'
  49. say '     Parameters = PROGTYPE=PM;EXENAME='exename';STARTUPDIR='startupdir
  50. say '         Option = REPLACE'
  51. say
  52.  
  53. if \isnotcorrect() & makeobj() then
  54.    say 'Installation successful!'
  55. else
  56.    say 'Cannot create Program Object!  Installation failed!'
  57.  
  58. exit
  59.  
  60. isnotcorrect:
  61.    call charout ,"Is this correct ? [Y/n] :"
  62.    key = ''
  63.    do until pos(key,"yYnN"||"0d"x) > 0
  64.       key = SysGetKey("ECHO")
  65.       call charout ,"082008"x
  66.    end /* do */
  67.    say key
  68.    return key = "n" | key = "N"
  69.  
  70. getname:
  71.    say "Please enter the complete path for" arg(1)
  72.    do forever
  73.       pull name
  74.       if translate(right(name,length(arg(1)))) \= arg(1) then
  75.          if right(name,1) = "\" then
  76.             name = name||arg(1)
  77.          else
  78.             name = name"\"arg(1)
  79.       if stream(name,"c","query exists") = '' then
  80.          say "The path '"name"' is invalid!  Please enter it again."
  81.       else
  82.          leave
  83.    end
  84.    return name
  85.  
  86. makeobj:
  87.    return SysCreateObject("WPProgram", ,
  88.                           "ShiftLock2", ,
  89.                           "<WP_START>", ,
  90.                           "PROGTYPE=PM;EXENAME="exename";STARTUPDIR="||startupdir, ,
  91.                           "REPLACE")
  92.  
  93. halt:
  94.    say 'Installation aborted!'
  95.    exit
  96.