home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
swCHIP 1991 January
/
swCHIP_95-1.bin
/
utility
/
batsh201
/
sample1.bsh
< prev
next >
Wrap
Text File
|
1995-12-09
|
3KB
|
123 lines
REM DEMO for the 3 types of message boxes
;*******************************************
wait off
:restart
if %$VER%==>201 goto start
message Version Info
This DEMO will stop here
You should upgrade to version
2.01 or later
Please contact the Help file
for the upgrade site
.
exit
:start
message WELCOME
With BATSH you can display a message on the screen,
and define 3 different types of prompt for user-response
The following messages will show the
CHOICE and the ASK prompt
.click here to continue,60
;*******************************************************
; new program label
label Choose an Option
message CHOICE prompt
The next message box will show the ASK prompt:
An INPUT field + OK button
Type C to continue (default after 120 seconds)
E to exit
or any other key to restart the DEMO
.CHOICE C,E,$A,#20
;*************************************************
if errorlevel 3 goto restart
if errorlevel 2 exit
; change icon to system defined questionmark
icon question
; new program label
label USERNAME
; reset variables
; $$USER stores the input as global variable
; try will be used as counter
set try=0
set $$USER=
; ************ ASK-MESSAGE ***************
:retry
; the value of TRY defines further action and
; the text for the ASK box
inc try
if %try%==3 goto continue
if %try%==2 set line1=One more try !
if %try%==1 set line1=Demo asking for user-name and presenting a message box
message ASK prompt
%line1%
Enter your name please:
(you can use upper- and lower-case letters)
.ask $$USER
; loop if the user did not enter a word ($$USER empty)
if errorlevel 1 goto retry
; this line is reached, after two 'empty' tries (try=2)
; or after getting a name
:continue
set $PASSWORD=
message hidden input
The following input box shows all typed
characters as *
Try it:
.ask $PASSWORD
; set a default name if $$USER is empty
if '%$$USER%'=='' set $$USER=Mr. NoName
;*******************************************************
; change icon to system defined exclamation-point
icon exclamation
; new program label
label message
:redo
set cmdln=
message BATSH Commandline
Hi %$$USER%
With BATSH you can give written commands to WINDOWS.
Normally you write a file with one command per line,
In this demo you can now test the program typing a
single command.
e.g.
run icon calc (start the calculator minimized)
show icon File Manager (minimize File Manager)
icon question (make the BATSH icon a question mark)
See the BATSH help-file for a complete list of commands
Try it:
.ask cmdln
if '%cmdln%'=='' exit
%cmdln%
set cmdln=
message BATSH
This is the last message-box of the DEMO.
It's again a CHOICE prompt
Type:
C - to go back and enter another command
or
any other key - to end the DEMO (default after 30seconds)
.CHOICE $A,C,#30
if errorlevel 2 goto redo