; Installer script for MCEd
; $VER: Install MCEd 1.9 (1.2.95)

(complete 0)

(set @default-dest "REXX:CEDScripts")

(set #comm-dir "CEDScripts/")

; ***************************************************************************
; English strings

(if (= @language "english")
	(
		(set #welcome
			(cat "\nMCEd installation\n\n\n"
						"This script installs MCEd 1.0\n"
						"on your Amiga.\n\n\n\n"
						"MCEd package is\n"
						"Copyright © 1994-95 Michael Letowski\n"
						"All rights reserved.\n\n"))

		(set #where-commands
			(cat "Where should MCEd scripts be installed?"))

		(set #where-help
			(cat "\n\"REXX:\" is a place to hold\n"
						" your ARexx scripts.\n"
						"\"CEDScripts\" drawer is a default\n"
						" drawer for CEd's scripts.\n\n"))

		(set #which-commands
			(cat "Which MCEd scripts should be installed?"))

		(set #which-commands-help
			(cat "\n\n\"MakeComment.ced\" makes boxed comments;"
						"\n\n\"Paginate.ced\" inserts page numbers;"
						"\n\n\"Preview.ced\" shows current file with formatting;"
						"\n\n\"Stats.ced\" shows basic text's statistics;"
						"\n\n\"Undo.ced\" undoes changes made by MCEd scripts.\n\n\n"))
	)
)

; ***************************************************************************
; Install MCommands

(message #welcome)

(welcome)
(set old_level @user-level)

(user 2)
(set #mcommands-dir
	(askdir
		(prompt #where-commands)
		(help #where-help)
		(default @default-dest))
)

; Choose commands
(set commands
	(askoptions
		(prompt #which-commands)
		(help #which-commands-help @askoptions-help)
		(choices
			"MakeComment.ced"
			"Paginate.ced"
			"Preview.ced"
			"Stats.ced"
			"Undo.ced")
	)
)

; Do copy
(user old_level)
(set n 0)
(while
	(set comm
		(select n
			"MakeComment.ced"
			"Paginate.ced"
			"Preview.ced"
			"Stats.ced"
			"Undo.ced"
			"")
	)
	(
		(if (IN commands n)
			(copyfiles
				(source (cat #comm-dir comm))
				(dest #mcommands-dir)
			)
		)
		(set n (+ n 1))
		(complete (* n 20))
	)
)

(set @default-dest #mcommands-dir)
(complete 100)
(exit)
