[futurebasic] Att: Stu Cram

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Brian Heibert <heibert@...>
Date: Tue, 19 Dec 2006 09:41:13 -0700
Hi,

I am attempting another interpreter
How do I go about getting what the user types after the command
for example PRINT hello world

I tried LONG IFs and had trouble getting the text after print
so I thought I'd try SELECT CASEs
and I am still having trouble what am I doing wrong?

How do I determine how long the user's text after PRINT will be?
theRest$ = RIGHT$(lineStr,7)
to adjust the above code

local fn ParseEFLines( efID as long )
dim as handle  efH
dim as long    i, numLines
dim as str255  lineStr

// Obtain handle to selected edit field
efH = TeHandle( efID )

// Test for valid handle
long if ( efH != 0 )
numLines = efH..teNLines%
// Test to see if EF contains any lines
long if ( numLines > 0 )
for i = 1 to numLines
lineStr = edit$( efID, i )
theRest$ = RIGHT$(lineStr,7)
select case lineStr
case "BEEP"
beep

case "PRINT"
PRINT theRest
end select
next i

// Do your stuff with each line here
end if
end if

end fn

Brian