.key W,H,NOBOOT/S,TIME/S
.bra {
.ket }

; $VER: Special Karate Launcher v1.0 (11.1o.2oo3-26.o6.2oo4) By PureLamers

; .desc   : Use this Script to Launch Your Karate Script
; .usage  : Launcher [ optional Arguments: xx xx NOBOOT/S TIME/S ]
; .config : Fill in the script, bootscript and readme file to use in the next
;           section.
;           In case of error on script name, Launcher will bring up a requester
;           to let you start the script and check the spelling

; Setting noticeable string value (script and loading script)
;------------------------------------------------------------------------------
;--Set Here the value according to YOUR script---------------------------------
;------------------------------------------------------------------------------
set script data/butterflyTV.k                        ;script to launch
;set boot ""                                         ;bootscript to use
set type ""                                          ;readme file to type
;set type s/2k4.nfo  ;";" this line to deactivate readme printing after demo


;------------------------------------------------------------------------------
;--Don't Touch The following lines---------------------------------------------
;------------------------------------------------------------------------------

; Have we got a script ?
if NOT EXISTS $script
	RequestFile "" file $script TITLE "Select Script to launch" >t:LauncherScriptTemp
	if WARN
		delete t:LauncherScriptTemp >NIL:
		exit
	endif
	set script `type t:LauncherScriptTemp`
	delete t:LauncherScriptTemp >NIL:
endif

; Have we got a bootscript ?
if NOT EXISTS $boot
	Set LocalNoBoot "NOBOOT"
else
	Set LocalNoBoot "{NOBOOT}"
endif

; Flushing previously run Karate libs
avail flush >nil: 

; and now for the real script...
Set Zero 0

if "{W}" EQ ""
;	echo "no W"
	Set Zero 1
endif

if "{H}" EQ ""
;	echo "no H"
	Set Zero 1
endif

if $Zero EQ 1
;	echo "no W or no H"
	Set w " "
	Set h " "
else
	Set w {W}
	Set h {H}
endif

UnSet Zero

;echo "h (" {H} ") =>" $h "| w (" {W} ") =>" $w "| s" {S}

Avail flush >NIL:

if {TIME} eq "time"
	Date
endif
 
if $LocalNoBoot eq ""
	karate s=$script b=$boot h=$h w=$w
else
	karate s=$script h=$h w=$w
endif

if {TIME} eq "time"
	Date
endif

if $type
	multiview $type
endif

Unset h
Unset w
Unset script
Unset boot
Unset LocalNoBoot
Unset type

; Flushing THIS Karate library instance
Avail Flush >nil:
