home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / utils / command.zip / INSTALL.PTB < prev    next >
Text File  |  1990-08-04  |  20KB  |  712 lines

  1. ; This is a listing of the Windows Batch file used to install Command Post
  2. ; This file is not runable as is.  It has been compiled into INSTALL.EXE
  3. ; by the PubTech BatchWorks Compiler, to be released in the summer of 1990
  4.  
  5.  
  6. instver=714                ; INSTALL VERSION NUMBER
  7. fff1='#CHANGES.TXT'          ;Files that should be in scratch dir when de-arced
  8. fff2='#WININI.TXT'
  9. fff3='BROWSER.EXE'
  10. fff4='CMDPOST.CPM'
  11. fff5='CMDPOST.EXE'
  12. fff6='CMDPOST.TXT'
  13. fff7='CMDUSER.CPM'
  14. fff8='CP_BLNK.EXE'
  15. fff9='CP_DLL.EXE'
  16. fff10='CP_DLL3.EXE'
  17. fff11='CP_HELP.CRD'
  18. fff12='CP_INFO.EXE'
  19. fff13='CP_TREE.EXE'
  20. fff14='CP_VIRT.BAT'
  21. fff15='TASKMANR.EXE'
  22. fff16='WININFO.EXE'
  23. fff17='CP_QUEST.CRD'
  24. fff18='LICENSE.TXT'
  25. fffmax=18
  26. IgnoreInput(@TRUE)              ;disable keyboard/mouse input
  27. source=DirGet()                ;Cet current directory
  28. WriteTitle="Command Post Notes"        ;Title for Write Window
  29. ro=@FALSE                ;readonly error=FALSE
  30. StartCP=@FALSE                ;don't start CP
  31. disktemp=environ("TEMP")
  32. if strlen(disktemp)==0 then disktemp="C:\"  ;for HISTORY.TXT if install bombs
  33.  
  34. a=WinVersion(1)                ;Check Windows Version
  35. altshell="PROGMAN.EXE"            ;Set default shell
  36. altclass="Progman"            ;shell class name (techie stuff)
  37. if a==3 then winver="3XX"        ;PIF file suffix for Win 3.0
  38. if a==3 then goto gotver        
  39.  
  40. altshell="MSDOS.EXE"            ;Set def shell for Windows 2.x
  41. altclass="Session"            ;shell class name
  42. a=strupper(iniread("WIN386","ALTTAB","ZYX"))    ;Are we in WIN 2.x 386
  43. if a=="ZYX" then winver="2X2"        ;Probably not
  44. if a=="ZYX" then goto gotver        
  45. winver="2X3"                ;Prolly in WIN 2.x 386
  46.  
  47.  
  48.  
  49. :gotver
  50. cr=strcat(num2char(13),num2char(10))    ;Make a CRLF
  51. tab=num2char(9)                ;Make a TAB
  52. CPI="Command Post Installation"        ;Default Box title
  53.  
  54.  
  55.                     ;Introductory messages
  56. Pause(CPI,"This is the Command Post%cr%installation procedure Ver %instver%.%cr%%cr%This install procedure was%cr%developed using%cr%PubTech« BatchWorks«.")
  57.  
  58. a=FileLocate(altshell)            ;Locate Alternate shell        
  59. if a!="" then goto MSOK            ;Can we find one???
  60. Message(CPI,"Error: File %altshell% not found in PATH,%cr%cannot use this installation program.")
  61. goto crash                ;Apparently not...exit
  62.  
  63. :MSOK                    ;Found alt shell
  64. a=FileLocate("notepad.exe")        ;Locate Notepad editor
  65. if a!="" then goto NOTEOK        ;Found Notepad?
  66. Message(CPI,"Error: File NOTEPAD.EXE not found in PATH,%cr%cannot use this installation program.")
  67. goto crash                ;Apparently not...exit
  68.  
  69. :NOTEOK                    ;Found Notepad
  70. a=FindWindow(altclass)            ;Is alternate shell running (techie stuff here)
  71. if a=="" then run(altshell,"")        ;If not, run alternate shell
  72.  
  73. RunZoom("NOTEPAD.EXE","")          ;Run NOTEPAD.EXE, and ZOOM it
  74. Yield
  75. Yield                   ;Make sure Write gets going
  76. WinTitle("Notepad",WriteTitle)          ;Change WRITE title
  77. Yield
  78. WinActivate(WriteTitle)            ;Activate WRITE WINDOW
  79. Clipput("Command Post Installation Notes%cr%(Using Install Ver %instver%)")  ;Put text into clipboard
  80. SendKey("+{INSERT}~~")            ;and paste it into write (neat huh?)
  81.  
  82.  
  83. WinActivate(WriteTitle)
  84. Clipput("Closing any preexisting Command Post windows.")
  85. SendKey("+{INSERT}~")
  86.  
  87.                     ;Kill off any old Command Post's
  88. cpmax=10                 ;Kill off up to 10 of them
  89.     
  90. :killnext                ;top of loop
  91. if cpmax!=0 then goto killcont        ;if not 10 closed yet, keep trying
  92. beep                    ;Gee, closed 10 of em, aand there still here
  93. message("Error","Unable to terminate current Command Post.%cr%Restart Windows and retry.")
  94. goto crash                ;Give up
  95.  
  96. :killcont
  97. a=FindWindow("Peanuts24")        ;Find a 7.0+ series CP
  98.  
  99. if a == "" then goto killdone        ;if no find...Must be all closed
  100. winclose(a)                ;Close a 7.0+ Command Psot
  101. cpmax=cpmax-1                ;decrement counter
  102. yield                    ;pause a tad
  103. goto killnext                ;try again
  104.  
  105. :killdone
  106. if cpmax!=0 then goto killc2        ;Just like above, except close
  107. beep                    ;a 6.2K or previous CmdPost here
  108. Message("Error","Unable to terminate old Command Post.%cr%Please rerun install without Command Post.")
  109. goto crash
  110.  
  111. :killc2
  112. a=findwindow("CmdPostIsGreat")
  113. if a=="" then goto allclosed
  114. winclose(a)
  115. cpmax=cpmax-1
  116. yield
  117. goto killdone
  118.  
  119. :allclosed
  120. Error(@off)
  121. WinIconize("MS-DOS")
  122. Error(@CANCEL)
  123.  
  124. WinActivate(WriteTitle)            ;Write sumore stuff to WRITE
  125. Clipput("All CmdPost windows closed.  Checking for target directory.")
  126. SendKey("+{INSERT}~")
  127.  
  128. :redotarget
  129. path=strcat(strupper(environ("PATH")),";")    ;Get DOS PATH
  130.  
  131. target=filelocate("cmdpost.exe")        ;Find existing CmdPost, if any
  132. if target=="" then target=filelocate("WIN.INI") ;No find?  Try find WIN.INI
  133. a=strindex(target,"\",0,@BACKSCAN)        ;find final forwardslash
  134. if a!=0 then target=strsub(target,1,a)            ;peel off directory
  135.  
  136.                         ;Query for target directory
  137. target1=strupper(askLine("CmdPost Installation","Enter directory to install CmdPost into",target))
  138. if target1!="" then target=target1
  139. a=strlen(target)                ;remove possible final \
  140. if a<5 then goto next1
  141. if strsub(target,a,1)=='\' then target=strsub(target,1,a-1)
  142.  
  143. :next1                    ;Is directory specified in PATH
  144. target=strcat(target,";")
  145. a=strindex(path,target,0,@FWDSCAN)
  146. if a!=0 then goto okpath
  147. message("Attention","Directory specified not defined in PATH statement.%cr%CmdPost MUST be in a directory in the PATH")
  148. goto redotarget                ;try again. Gotta be in path!!
  149.  
  150.  
  151.  
  152.  
  153. :okpath                    ;OK, we like target directory
  154. WinActivate(WriteTitle)
  155. Clipput("Command Post installing to %target%.")
  156. SendKey("+{INSERT}~")
  157.  
  158. a=strsub(target,1,1)            ;Make sure target is not a floppy!!
  159. if a=="A" then goto flop
  160. if a=="B" then goto flop
  161. goto okpath2
  162. :flop
  163. Message("CmdPost Install Error","Cannot install to a floppy")
  164. goto allclosed
  165.  
  166. :okpath2            ;add final \ to dirname EXCEPT for X:\ case
  167. a=strlen(target)
  168. target=strsub(target,1,a-1)
  169. if a>4 then strcat(target,"\")
  170.  
  171. Error(@OFF)            ;Disable low-level errors
  172. WinActivate(WriteTitle)
  173. Clipput("Deleting old version of Command Post, if any.")
  174. SendKey("+{INSERT}~")
  175.  
  176. a="CMDPOST.EXE"            ;Set var a to a file name
  177. ret="zz1"
  178. goto DelFile
  179.  
  180. :zz1                ;Ditto, See above....
  181. a="CP_BLNK.EXE"
  182. ret="zz2"
  183. goto DelFile
  184.  
  185. :zz2
  186. a="CP_DLL.EXE"
  187. ret="zz3"
  188. goto DelFile
  189.  
  190. :zz3
  191. a="CP_DLL3.EXE"
  192. ret="zz4"
  193. goto DelFile
  194.  
  195. :zz4
  196. a="CP_INFO.EXE"
  197. ret="zz5"
  198. goto DelFile
  199.  
  200. :zz5
  201. a="CP_TREE.EXE"
  202. ret="zz6"
  203. goto DelFile
  204.  
  205. :zz6
  206. a="WININFO.EXE"
  207. ret="zz7"
  208. goto DelFile
  209.  
  210. :zz7
  211. a="cmdlib2.exe"
  212. ret="zz8"
  213. goto DelFile
  214.  
  215. :zz8
  216. a="cmdlib.exe"
  217. ret="zz9"
  218. goto DelFile
  219.  
  220. :zz9
  221. a="cmdtree.exe"
  222. ret="zz10"
  223. goto DelFile
  224.  
  225. :zz10
  226. a="cp_help.crd"
  227. ret="zzbrow"
  228. goto DelFile
  229.  
  230. :zzbrow
  231. a="browser.exe"
  232. ret="zz11"
  233. goto DelFile
  234.  
  235. :zz11                    ;Applets delete section here
  236.                     ;See if applets installed
  237. a=FileLocate("}PLACE.EXE")    
  238. b=FileLocate("}DELETE.EXE")
  239. c=FileLocate("}COPY.EXE")
  240. a=strcat(a,b,c)
  241. if a=="" then goto deltxt1        ;if a=="" applets apparently not here
  242.  
  243.                     ;Applets found, ask about delete
  244.                     ;Most people, this would be OK, cept
  245.                     ;some people use them in W4W or EXCEL macros
  246.  
  247. a=AskYesNo(CPI,"Applets detected on system.  The new Command Post%cr%supercedes Applets.  Do you%cr%wish to delete the Applet files?")
  248. if a==@NO then goto deltxt2        ; Skip delete of Applets
  249.  
  250. a = "}ARRANGE.EXE"            ;See file deletion comments way way
  251. ret="zz12"
  252. goto DelFile
  253.  
  254. :zz12
  255. a = "}BEEP.EXE"
  256. ret="zz13"
  257. goto DelFile
  258.  
  259. :zz13
  260. a = "}CLOSALL.EXE"
  261. ret="zz14"
  262. goto DelFile
  263.  
  264. :zz14
  265. a = "}CLOSE.EXE"
  266. ret="zz15"
  267. goto DelFile
  268.  
  269. :zz15
  270. a = "}COPY.EXE"
  271. ret="zz16"
  272. goto DelFile
  273.  
  274. :zz16
  275. a = "}DELETE.EXE"
  276. ret="zz17"
  277. goto DelFile
  278.  
  279. :zz17
  280. a = "}HIDE.EXE"
  281. ret="zz18"
  282. goto DelFile
  283.  
  284. :zz18
  285. a = "}ICONIZE.EXE"
  286. ret="zz19"
  287. goto DelFile
  288.  
  289. :zz19
  290. a = "}MOVE.EXE"
  291. ret="zz20"
  292. goto DelFile
  293.  
  294. :zz20
  295. a = "}NOP.EXE"
  296. ret="zz21"
  297. goto DelFile
  298.  
  299. :zz21
  300. a = "}PLACE.EXE"
  301. ret="zz22"
  302. goto DelFile
  303.  
  304. :zz22
  305. a = "}RENAME.EXE"
  306. ret="zz23"
  307. goto DelFile
  308.  
  309. :zz23
  310. a = "}SAY.EXE"
  311. ret="zz24"
  312. goto DelFile
  313.  
  314. :zz24
  315. a = "}SAYBEEP.EXE"
  316. ret="zz25"
  317. goto DelFile
  318.  
  319. :zz25
  320. a = "}SAYFILE.EXE"
  321. ret="zz26"
  322. goto DelFile
  323.  
  324. :zz26
  325. a = "}SHOW.EXE"
  326. ret="zz27"
  327. goto DelFile
  328.  
  329. :zz27
  330. a = "}ZOOM.EXE"
  331. ret="zz28"
  332. goto DelFile
  333.  
  334. :zz28
  335. a = "}RUN1ST.EXE"
  336. ret="zz29"
  337. goto DelFile
  338.  
  339. :deltxt1            ;Delete old DOC files, if any here...below
  340. :zz29
  341. a = "APPLETS.TXT"
  342. ret="zz30"
  343. goto DelFile
  344.  
  345. :deltxt2
  346. :zz30
  347. a = "BROWSER.TXT"
  348. ret="zz31"
  349. goto DelFile
  350.  
  351. :zz31
  352. a = "CMDPOST.TXT"
  353. ret="zz32"
  354. goto DelFile
  355.  
  356.  
  357.  
  358.  
  359.  
  360. :zz32                ;TaDaa....All files deleted.
  361. Error(@ON)            ;Re-enable errors
  362. if ro==@TRUE then goto readonly ;If readonly error flag set, goto error exit
  363.  
  364. :trydiragain
  365. instdir="\CP-NOTES.TMP"        ;scratch Directory
  366. disktemp=environ("TEMP")    ;Locate TEMP disk space
  367. if strlen(disktemp)==0 then goto tempnull    ;was TEMP defined in autoexec.bat?
  368. mydisk=strsub(disktemp,1,2)    ;Peel off temp disk drive
  369. goto tempgot            ;Got a temporary drive'
  370.  
  371. :tempnull            ;Hmmm not temp drive, well use C: then.
  372. mydisk="C:"
  373.  
  374. :tempgot            ;Got the temp drive...
  375. disktemp=strcat(mydisk,instdir) ;Build temp install path
  376.  
  377. disktemp=AskLine(CPI,"Enter pathname to scratch directory.%cr%Must have 600K bytes available on disk.%cr%All files in specified directory will be deleted.",disktemp)
  378. disktemp=strtrim(strupper(disktemp))
  379. a=strlen(disktemp)
  380. if a<3 then goto tempgot
  381. if strsub(disktemp,2,1)!=":" then goto tempgot
  382.  
  383. if a<5 then goto diroops   ; not in the root PLEASE
  384. if strsub(disktemp,a,1)=="\" then disktemp=strsub(disktemp,1,a-1)
  385. :tempgot1
  386. mydisk=strsub(disktemp,1,2)
  387. instdir=strsub(disktemp,3,strlen(disktemp)-2)
  388.  
  389. WinActivate(WriteTitle)
  390. Clipput("Using %disktemp%  on %mydisk% as temporary/documentation directory.")
  391. SendKey("+{INSERT}~")
  392. a=FileLocate(altshell)
  393. a=strsub(a,1,strlen(a)-strlen(altshell)-1)
  394. if a==disktemp then goto diroops
  395.  
  396.  
  397. logdisk(mydisk)            ;Log to temp disk
  398. error(@OFF)
  399. DirMake(instdir)        ;Create temp directory
  400. LastError=0
  401. DirChange(disktemp)
  402. if LastError==0 then goto dircont
  403.  
  404. :diroops
  405. WinActivate(WriteTitle)
  406. a="%disktemp% seems to be an invalid path/directory%cr%for the work area"
  407. Clipput(a)
  408. SendKey("+{INSERT}~")
  409. error(@CANCEL)
  410. Message(CPI,a)
  411. goto trydiragain
  412.  
  413. :dircont
  414. error(@CANCEL)
  415.  
  416.  
  417.  
  418. WinActivate(WriteTitle)        ;Delete files in temp directory
  419. Clipput("Deleting all files in %disktemp%")
  420. SendKey("+{INSERT}~")
  421.  
  422.  
  423. Error(@OFF)            ;Delete files in temp directory
  424. FileDelete(strcat(disktemp,"\*.*"))
  425. Error(@ON)
  426.  
  427. dirchange(source)        ;Change to source directory    
  428.  
  429. WinActivate(WriteTitle)
  430. Clipput("Copying CP_INST.SFX, a self-extracting compressed file, to %disktemp%.")
  431. SendKey("+{INSERT}~")
  432. FileCopy("cp_inst.sfx",strcat(disktemp,"\cp_inst.exe"))
  433.  
  434. WinActivate(WriteTitle)
  435. Clipput("Copying LICENSE.TXT to %disktemp%.")
  436. SendKey("+{INSERT}~")
  437. FileCopy("license.txt",strcat(disktemp,"\license.txt"))
  438.  
  439. WinActivate(WriteTitle)
  440. Clipput("Copying README.1ST, if found, to %disktemp%.")
  441. SendKey("+{INSERT}~")
  442. error(@OFF)
  443. FileCopy("readme.1st",strcat(disktemp,"\readme.1st"))
  444. error(@ON)
  445.  
  446. WinActivate(WriteTitle)
  447. Clipput("Copying CP_QUEST.CRD, a Q&A cardfile to %disktemp%.")
  448. SendKey("+{INSERT}~")
  449. FileCopy("cp_quest.crd",strcat(disktemp,"\cp_quest.crd"))
  450.  
  451.  
  452. WinActivate(WriteTitle)
  453. Clipput("Generating CP_INST.PIF to run CP_INST.EXE.")
  454. SendKey("+{INSERT}~")
  455.                 ;Copying PIF file to temp directory
  456. FileCopy("CP_INST.%winver%",strcat(disktemp,"\cp_inst.pif"))
  457.  
  458. dirchange(disktemp)        ;change dir to temp directory
  459. WinActivate(WriteTitle)
  460. Clipput("Running CP_INST.EXE to extract files.%cr%")
  461. Clipappend("***************************************************%cr%")
  462. Clipappend("* Special thanks to Haruyasu Yoshizaki for making *%cr%")
  463. Clipappend("* his LHARC software available for this use.      *%cr%")
  464. Clipappend("***************************************************")
  465. SendKey("+{INSERT}~")
  466.  
  467. run("%disktemp%\cp_inst.exe","")        ;run the SFX file....
  468.  
  469.  
  470.  
  471. WinWaitCls("Command Post Install")    ;Wait 'till SFX done....
  472.  
  473.  
  474.  
  475. WinActivate(WriteTitle)        ;Clean up a tad
  476. Clipput("Deleting CP_INST.PIF and CP_INST.EXE.")
  477. SendKey("+{INSERT}~")
  478. FileDelete("CP_INST.PIF")
  479. FileDelete("CP_INST.EXE")
  480.  
  481.  
  482. ;Make sure all files we need are here.  Might have run out of disk space.
  483. a=1
  484. :filechkloop
  485. if a>fffmax then goto gotallfiles
  486. b=fff%a%
  487. c=FileLocate("%disktemp%\%b%")
  488. if c=="" then goto outofspace
  489. a=a+1
  490. goto filechkloop
  491. :gotallfiles
  492.  
  493. a=iniread("CmdPost","Info","AB2")
  494. if a!="AB2" then goto licskip
  495.  
  496.  
  497.                     ;Show message about Licensing policy.
  498. Message(CPI,"The Command Post licensing policy follows.%cr%Please read carefully.%cr%Close Notepad when done.")
  499.  
  500. runzoom("notepad.exe","license.txt")   ;Notepad on licensing policy.
  501.  
  502. IgnoreInput(@OFF)            ;Allow user to close notepad.
  503. WinWaitCls("Notepad - LICENSE.TXT")    ;Wait till notepad closed.
  504. IgnoreInput(@ON)            ; disable keyboard
  505.  
  506.                     ;Does user agree???
  507. a=AskYesNo(CPI,"Do you agree to abide by the Command Post licensing agreement")
  508. if a==@YES then goto abide        ;If yes, what a swell guy...
  509.  
  510. Message(CPI,"Installation terminated")    ;NO?  Well this install is OVER!
  511. WinActivate(WriteTitle)                ;Move help cardfile
  512. Clipput("Licensing agreement not accepted.")
  513. SendKey("+{INSERT}~")
  514. Clipput("Installation process terminated.")
  515. SendKey("+{INSERT}~")
  516.  
  517. goto crash                ;exit
  518.  
  519.  
  520. :abide                    ;Agrees with license policy
  521. WinActivate(WriteTitle)
  522. Clipput("Licensing agreement accepted.  Installation continuing.")
  523. SendKey("+{INSERT}~")
  524.  
  525. :licskip
  526. FileRename("taskmanr.exe","taskmanr.rpl")    ;Hide taskmanr.exe from FileMove below
  527.  
  528. WinActivate(WriteTitle)
  529. Clipput("Moving EXE files from %disktemp% to %target%.")
  530. SendKey("+{INSERT}~")
  531.  
  532. Error(@OFF)
  533. FileMove("*.exe",strcat(target,"\*.*"))        ;Move all EXE file (cept taskmanr)
  534. Error(@CANCEL)
  535.  
  536. FileRename("taskmanr.rpl","taskmanr.exe")    ;Restore taskmanr
  537.  
  538. WinActivate(WriteTitle)                ;Move help cardfile
  539. Clipput("Moving help cardfiles from %disktemp% to %target%.")
  540. SendKey("+{INSERT}~")
  541. FileMove("CP_HELP.CRD",strcat(target,"\*.*"))
  542. FileMove("CP_QUEST.CRD",strcat(target,"\*.*"))
  543.  
  544. WinActivate(WriteTitle)                ;Move help cardfile
  545. Clipput("Moving CP_VIRT.BAT file from %disktemp% to %target%.")
  546. SendKey("+{INSERT}~")
  547. FileMove("CP_VIRT.BAT",strcat(target,"\*.*"))
  548.  
  549. dirchange(target)                ;Change to target directory
  550. user=FileLocate("CMDUSER.CPM")            ;scout around for cmduser.cpm
  551. post=FileLocate("CMDPOST.CPM")            ;scout around for cmdpost.cpm
  552. dirchange(disktemp)                ;back to temp directory
  553.  
  554.                 ;If no cmduser.cpm, use ours.
  555. if user=="" then FileMove("CMDUSER.CPM",strcat(target,"\*.*"))
  556. if user=="" then Clipput("CMDUSER.CPM user menu file installed.")
  557.                 ;If cmduser.cpm found  NO TOUCH!!
  558. if user!="" then Clipput("CMDUSER.CPM user menu file found, NOT overwritten.")
  559. if user!='' then FileRename("CMDUSER.CPM","NEWUSER.CPM")
  560. WinActivate(WriteTitle)
  561. SendKey("+{INSERT}~")
  562.  
  563.                 ;If no cmdpost.cpm, install ours
  564. if post=="" then FileMove("CMDPOST.CPM",strcat(target,"\*.*"))
  565. if post=="" then clipput("CMDPOST.CPM master default menu installed.")
  566. if post=="" then goto cpmdid
  567.  
  568.                 ;CmdPost.cpm found.  Ask about it
  569. a=AskYesNo(CPI,"Do you wish to replace your CMDPOST.CPM file%cr%with our latest version?")
  570. clipput("CMDPOST.CPM file found.  NOT replaced, per your direction.")
  571. if a==@NO then FileRename("CMDPOST.CPM","NEWPOST.CPM")
  572. if a==@NO then goto cpmdid    ;If no, don't replace
  573.  
  574. c=strlen(post)            ;build name of x:\xxx\xxx\cmdpost.old
  575. postx=strsub(post,1,c-3)
  576. postx=strcat(postx,"OLD")
  577. Error(@OFF)
  578. FileDelete(postx)        ;Delete cmdpost.old if found
  579. Error(@CANCEL)
  580.  
  581. FileRename(post,postx)        ;rename cmdpost.cpm to cmdpost.old
  582. FileMove("CMDPOST.CPM",post)    ;Move out file to cmdpost.cpm
  583. clipput("%post% file updated with new version.%cr%Old Version renamed to %postx%")
  584.  
  585. :cpmdid                ;CPM file mashing complete.
  586. WinActivate(WriteTitle)
  587. SendKey("+{INSERT}~")
  588.  
  589.  
  590.                 ;Fixup WIN.INI
  591.                 ;Remove CmdPost from LOAD=
  592.                 ;Install CmdPost on RUN=
  593. a=strupper(iniread("windows","load",""))
  594. b=strupper(iniread("windows","run",""))
  595.  
  596. ;remove from load line
  597. if a=="" then goto noload
  598.  
  599. c=strindex(a,"CMDPOST.EXE",1,@FWDSCAN)        ;Whole bunch string parsing
  600. if c==0 then goto noload
  601. front=""
  602. back=""
  603. if c==1 then goto frontok
  604. front=strsub(a,1,c-1)
  605.  
  606. :frontok
  607. if strlen(a)<14 then goto backok
  608. if (c+13)>=strlen(a) then goto backok
  609. back=strsub(a,c+12,strlen(a)-c-12)
  610.  
  611. :backok
  612. clipput("CMDPOST.EXE removed from load=line in WIN.INI file.")
  613. WinActivate(WriteTitle)
  614. SendKey("+{INSERT}~")
  615.  
  616. iniwrite("windows","load",strcat(front," ",back))  ;re-write load=
  617.  
  618.  
  619. :noload
  620. if b=="" then goto addini
  621. c=strindex(b,"CMDPOST.EXE",1,@FWDSCAN)
  622. if c!=0 then goto runiniok        if already on run=, everything ok
  623.  
  624. :addini                    ;Add to run= line
  625. iniwrite("windows","run",strcat(b," CMDPOST.EXE"))
  626. clipput("CMDPOST.EXE added to run= line in WIN.INI file.")
  627. WinActivate(WriteTitle)
  628. SendKey("+{INSERT}~")
  629.  
  630. :runiniok
  631. dirchange(disktemp)            ;Back to temp directory.
  632.                     ;Windows 3.0....tell 'em about appendix
  633. if winver=="3XX" then Message(CPI,"Since you have Windows 3.0, please review%cr%the special Windows 3.0 appendix in the%cr%documentation to see how to make%cr%Command Post your primary shell and to%cr%see how to change the taskman.exe file.")
  634. IgnoreInput(@OFF)            ;Allow keyboard inputs.
  635.  
  636.                     ;Install all doned
  637. Message(CPI,"Command Post Installation Complete.%cr%Assorted documentation files may be%cr%found in the %disktemp%\ directory.%cr%%cr%If %disktemp%\ is on a RAM drive,%cr%please copy documentation files%cr%to a permanent drive before rebooting.")
  638. a=iniread("CmdPost","Info","AB2")
  639. if a=="AB2" then message(CPI,"If you have purchased a licensed%cr%copy of Command Post, please%cr%be sure to enter your license%cr%number to avoid the initial%cr%purchase solicitation messages.")
  640.  
  641. StartCP=@TRUE
  642. clipput("*** Installation completed normally ***")
  643. WinActivate(WriteTitle)
  644. SendKey("+{INSERT}~")
  645.  
  646.  
  647. goto History
  648.  
  649. :outofspace
  650. Message(CPI,"File extraction procedure failed.  Some files are missing.%cr%Scratch disk possibly out of space%cr% Missing file is %b%")
  651. clipput("Files missing.  Scratch disk out of space?  Ramdisk has too few possible files?%cr%Missing file is %b%")
  652. WinActivate(WriteTitle)
  653. SendKey("+{INSERT}~")
  654. goto crash
  655.  
  656.  
  657. :readonly                ;readonly file error exit
  658. Message(CPI,"Read-Only files found.  Please reset%cr%read-only attribute before trying again.")
  659.                     ;drop thru to general crash exit
  660. :crash
  661. Message(CPI,"ERROR: Command Post not properly installed")
  662. Message(CPI,"Tech Support, if required, at %cr% (206) 937-9335")
  663.                      ;hopefully not required
  664. clipput("*** Installation abnormally terminated. ***")
  665. WinActivate(WriteTitle)
  666. SendKey("+{INSERT}~")
  667.  
  668. :History
  669. WinActivate(WriteTitle)
  670. Error(@OFF)
  671. FileDelete("%disktemp%\HISTORY.TXT")
  672. Error(@CANCEL)
  673. WinActivate(WriteTitle)            ;Close down Write
  674. SendKey("!FA")
  675. SendKey("%disktemp%\HISTORY.TXT~")
  676. WinClose("Notepad - HISTORY.TXT")
  677.  
  678. if StartCP==@FALSE then exit
  679.  
  680. DirChange(disktemp)
  681. a=FileLocate("README.1ST")
  682. if a=="" then goto noreadme
  683. a=AskYesNo(CPI,"INSTALLATION COMPLETE%cr%Do you wish to read the README.1ST file?%cr%If so, close Notepad when done.")
  684. if a==@NO then goto noreadme
  685. runzoom("notepad.exe","README.1ST")   ;Notepad on readme.1st policy.
  686. IgnoreInput(@OFF)            ;Allow user to close notepad.
  687. WinWaitCls("Notepad - README.1ST")    ;Wait till notepad closed.
  688. IgnoreInput(@ON)            ; disable keyboard
  689.  
  690. :noreadme
  691. Display(3,CPI,"Please wait.%cr%Command Post starting up.");
  692. dirchange(target)            ;start up new Command Post.
  693. cpexe=strcat(target,"\cmdpost.exe")
  694. if FileLocate(cpexe)=="" then run("cmdpost.exe","")
  695. if FileLocate(cpexe)!="" then run(cpexe,"")
  696.  
  697. exit
  698.  
  699.  
  700.  
  701. :DelFile
  702. a=FileLocate(a)            ;Locate file name in path
  703. if a=="" then goto %ret%    ;if a=="" then file not found, do next one
  704. FileDelete(a)            ;Delete file
  705. WinActivate(WriteTitle)        ;Activate WRITE window
  706. Clipput("Deleted %a%")        ;Copy "Deleted <filename>" to clipboard
  707. b=FileLocate(a)            ;Check...Is file REALLY gone???
  708. if a==b then ro=@TRUE        ;if a==b, then file STILL THERE
  709. if a==b then ClipPut("*** %a% Not Deleted - Read/Only ***")  ;MUST BE READ ONLY, SET ERROR
  710. SendKey("+{INSERT}~")        ;Paste result to write
  711. goto %ret%
  712.