home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 1
/
crawlyvol1.bin
/
telecomm
/
storm100
/
recorder.bas
< prev
next >
Wrap
BASIC Source File
|
1993-11-03
|
2KB
|
48 lines
'This program records a series of user interactions and writes out.
'a basic program to play them back.
'It starts of by using the file selector to prompt you for a filename
'to record the macro under.
'l is the count of characters you have typed in.
'Type Control-U to finish
'Ignores the current prompt, starts with the line you type in.
'
'
TERM OFF :first = 1
l = 0:dq$ = CHR$(34):t = TIMER :REM Initialize variables.
bas$ = SET$("STORM","Paths","Basic")
IF LEN(bas$) = 0 THEN bas$ = "*.BAS"
f$ = FSEL$(bas$,""):IF f$ = "" THEN END :REM Get filename from user.
OPEN "w",#1,f$:PRINT #1,"TERM OFF"
FAST ON :'Fast doesn't interfere with keyinput
'
Top:b$ = "":REM Holds current line user is typing
'
Loop:KEYINPUT a$:IF a$ = CHR$(13) THEN GOSUB Response:GOTO Top
IF l = 0 AND first = 0 THEN pr$ = LTRIM$( PROMPT$(16))
IF a$ >= CHR$(32) THEN l = l + 1:b$ = b$ + a$:GOTO Loop
IF a$ = CHR$(8) THEN
IF l > 0 THEN b$ = LEFT$(b$, LEN(b$) - 1):l = l - 1
GOTO Loop
ENDIF
IF a$ = CHR$(21) THEN Finish:'Control-U ends
IF a$ = CHR$(13) THEN GOSUB Response
GOTO Loop
'
Finish:
pr$ = PROMPT$(16):GOSUB DoWait:
CLOSE #1
FAST OFF
END
'
Response:IF first = 1 THEN first = 0:GOTO Skip:REM First line skips prompt
GOSUB DoWait
Skip:IF b$ = "" THEN PRINT #1,"SEND" ELSE PRINT #1,"SEND ";dq$;b$;dq$
l = 0:pr$ = "":t = TIMER :'record time of last response
RETURN
'
DoWait:'Process WAIT statement.
IF pr$ = "" THEN RETURN :'Avoid waiting for empty string
PRINT #1,"WAIT ";( TIMER - t) * 2;",";dq$;pr$;dq$
RETURN