FWIW: code to #INCLUDE rather than execute as EXE:
Wait for key, click or clock for PB/WIN and PB/CC
X
-
sleep and sleepbrk
sleep waits for so many seconds then continues
sleepbrk does the same as sleep but can be canceled by pressing any key
you can use fractions of a second with sleep and sleepbrk
main use is for including command in batch files
sleep
Code:'pbcc 4.04 'sleep.bas #COMPILE EXE FUNCTION PBMAIN () AS LONG TEMP&&=VAL(COMMAND$)*1000&& IF TEMP&&=0&& THEN TEMP&&=1000&& SLEEP TEMP&& END FUNCTION
Code:REM SLEEPBRK.BAS REM PROGRAM TO SLEEP FOR GIVEN SECONDS ON COMMAND LINE UNLESS INTERRUPTED BY KEY REM POWERBASIC PBCC 4.0 REM VERSION 10-01-2006 #COMPILE EXE REM #DIM ALL FUNCTION PBMAIN () AS LONG SLEEPTIME&=VAL(COMMAND$) IF SLEEPTIME&<=0& THEN PRINT "error no seconds supplied on the command tail" PRINT "supply a number of seconds on the command line upto 8 days" PRINT "press any key to abort sleepbrk" SLEEPTIME&=10& END IF IF SLEEPTIME&>(86400*8&) THEN SLEEPTIME&=86400*8& PRINT "cannot set seconds to sleep longer than 8 days" PRINT "sleepbrk was reset to 8 days "+STR$(SLEEPTIME&)+" seconds" PRINT "press any key to abort sleepbrk" END IF SLEEPTIMENEW&=SLEEPTIME&*4& FOR x& = 1& TO SLEEPTIMENEW& SLEEP 250 Char$ = INKEY$ IF Char$ <> "" THEN EXIT FOR NEXT x& END FUNCTION
Tags: None
-
Leave a comment: