(view source code of pmchoice.kix as plain text)
; PMCHOICE.KIX, Version 2.00 for Windows NT
; Poor Man's replacement for the CHOICE command from the NT Resource Kit.
; Needs PMCHOICE.BAT to convert original parameters to Kix variables.
; Requires KiXtart 4.01 or later if a timeout is specified.
; Batch/KiXtart combination follows the original CHOICE.EXE syntax.
; Written by Rob van der Woude
; Show text if required
If $Text <> ""
; Show prompt if required
If $NoPrompt <> 1
"? [" + $Choices + "]"
If $TimeOut = 0
; Wait infinitely for key to be pressed
; Requires at least KiXtart 4.01
If $KixMajorVer < 4
? "PMChoice.kix requires KiXtart version 4.01 or later."
? "Your KiXtart version is " + @KIX + "."
; Check if key is pressed
; Check if key is pressed each second during timeout interval
$Counter = 0
; Default in case no key will be pressed before end of timeout
$Key = Chr( 13 )
$Counter = $Counter + 1
; Once pressed, read and then exit loop
$Counter = $TimeOut
Until $Counter = $TimeOut
; Pressing Esc results in return code 0
; Pressing Enter results in default (if defined!)
$Key = $Default
; The return code must be the position of the key in the choices string
$Return = InStr( "$Choices", "$Key" )
; Beep and start again if an invalid key was pressed
If $Return = 0
; If cases sensitivity was defined, check if the cases match
If $Cs = "1"
; Exit with the proper return code
page last uploaded: 2019-01-21, 22:48