home *** CD-ROM | disk | FTP | other *** search
- These samples are more or less in order of increaing difficulty to
- understand. They show some of the capabilities of ESET.
-
- ** Test if a directory is in the path and if not add it as the 2nd one
- Eset /U Path*=/c:\turboc;/c:\turboc;/ /N Path*=/;/;c:\turboc;/
-
- ** Accept a single key response without ENTER, default to Y on enter only
- Eset Z=Y /UEav Z "Yes, No Maybe, Forgetit >" YyNnMmFf 1
-
- ** Check to see if var contains a : then change all to a /
- Eset Z*=.:./. /B Z@=.:./.
-
- ** Split date into 3 parts M D and Y
- Eset M=$D D=$S4,2,%%M Y=$S7,4,%%M M=$S1,2,%%M
-
- ** if Z is undefined set it to 'ok'
- Eset Z*=/// /N Z=ok
-
- ** Define and use a variable ES with default switches
- to set Eset Es=/DX
- to use Eset %%Es ........
-
- ** Allow user to change variable
- ECHO %XX%
- Eset Xx* "enter /old/new/"
- or
- Eset /D Xx+= /D Xx* " enter /old/new/"
-
- ** Allow user to edit variable
- Eset /E Xx "?" 20
-
- ** If item does not contain a slash have user correct
- :Rentr
- Eset xx*=,/,/, /eun xx "Must contain a / > " 15
- IF NOT ERRORLEVEL 3 GOTO Rentr
-
- ** If user answers Y ask for a name
- Eset /UEa Z=y Z another? 1 Z*=/y/y/ /Bea Z name?
-
- ** Ask for a variable name and then edit it
- Eset /dx zz "? " /e %%zz "?" 127 zz=
-
- ** get list from user and bracket with spaces or , depending on what
- ** the user used
- Eset /UT Z "? " Z*=/,/,/ /B
- IF (%Z%)==() GOTO Cont
- IF NOT ERRORLEVEL 3 Eset "Z^=," "Z+=," /C
- IF ERRORLEVEL 3 Eset "Z^= " "Z+= " /C
-
- ** get user input, if timeout set time limit for all other queries
- Eset Zl= /UEavL5 Z ? Nn 1
- IF (%$e%)==(512) Eset Zl=l5
- ** use limit
- Eset Z= /UEav%Zl% Z ? QqYyNnRrPpMm 1
-
- ** Extract first item from a list: [List=xxx yyy zzz]
- eset X=x "X*= x %List% " /T List-=%%X
- ** or [List=xxx,yyy,zzz,]
- Eset X=x "X*=,x,%List%," List-=%%X%%,
-
- ** set n1-n4 with s1-s4 which donot exist in n1-n4 or m1-m4
- Eset Z=%N1%%N2%%N3%%N4%%M1%%M2%%M3%%M4% Zc=1
- FOR %%Z IN (%N1% %N2% %N3% %N4%) DO Eset Zc=$+1
- FOR %%Z IN (%S1% %S2% %S3% %S4%) DO Eset Z*=/%%Z/%%Z/ /N Z+=%%Z N%Zc%=%%Z Zc=$+1
-
- ** same using loop
- Eset Z=%x1%%x2%%x3%%x4%%M1%%M2%%M3%%M4% Zc=1 Zp=0
- FOR %%Y IN (%x1% %x2% %x3% %x4%) DO Eset Zc=$+1
- :Loop
- Eset Zp=$+1 Z*=/%%Zp%%/%%Zp%%/ /N Z+=%%Zp x%Zc%=%%Zp Zc=$+1
- IF NOT (%Zp%)==(%Sx%) GOTO Loop
-
-