'THIS PROGRAM IS INTENDED TO BE RUN FROM AN EXTERNAL TERMINAL
'SUCH AS HYPERTERMINAL
'FOR HYPERTERMINAL, USE PORT 5002 TO CONNECT WINSOCK TO ACR9000 ETHERNET
CLEAR : REM Clear any variables dimension in program
DIM $V(1,10) : REM Dimensions one string variable of length 10
GOSUB OPENPORT : REM Go to SUBROUTINE OPENPORT
'Opens Ethernet Stream3 (ACR-View uses Stream2)
OPEN "STREAM3:" AS #1
'Continuous loop as long as "X" is not entered
'Set String Variable 0 to nothing
$V0 = ""
PRINT #1, ""
PRINT #1, "What kind of fruit do you want?"
PRINT #1, "(A)pple, (B)anana, (C)oconut"
PRINT #1, "I would like to have a";
'Infinite WHILE loop if they do not enter anything
WHILE ($V0 = "")
$V0 = UCASE$(INKEY$(1))
REM Stores Keyboard entry into String Variable 0
IF ($V0 = "A") THEN PRINT #1, "n Apple"
REM If "A" was entered, then print n Apple
IF ($V0 = "B") THEN PRINT #1, " Banana"
REM If "B" was entered, then print Banana
IF ($V0 = "C") THEN PRINT #1, " Coconut"
REM If "C" was entered, then print Coconut
IF ($V0 = "X") THEN GOTO LOOP2
REM If "X" was entered, then goto LOOP2 to terminate program
IF ($V0 = CHR$(27)) THEN GOTO LOOP2
REM If "ESC key" was entered, then goto LOOP2 to terminate program
'Goes back to LOOP1
PRINT #1, "Program terminated"
Products: ACR9000, 9030,9040,9600,9630,9640, Aries Controller (AR-xxCE)
When using INPUT commands in AcroBasic programs, it is possible for the program to get STUCK. If the program is running and waiting on INPUT and then halted, subsequent calls to run will get an error.
To recover from this condition clear the reserved program flag shown in this list for the program in question.
To prevent, consider using an Escape key as an option to exit (see INKEY_update.txt above) and/or a timeout if a character isn't sent within some period of time.