See response below... On Jan 11, 2006, at 6:03 PM, Brian Heibert wrote: > I tried that and it didn't work > OK I won't be persistant about wanting to do it my way > I'll try some other way > I guess I will have to change all LONG IFs to CASES? > > Brian > > On Jan 11, 2006, at 6:55 PM, Stu Cram wrote: >> dim wnumx, wtx$ >> LONG IF left$(lineStr,5 ) = "WIN# " >> wnumx = VAL( MID$(lineStr,6) ) >> wtx$ = MID$(lineStr,8) >> WINDOW wnumx, wtx$ // make the new window >> WINDOW _editorWnd // and return to editor window >> END IF >> >> LONG IF left$(lineStr,6) = "PRINT " >> WINDOW OUTPUT wnumx >> PRINT MID$(lineStr,7) >> WINDOW _editorWnd // and return to editor window >> END IF > ===================================================================== Brian, I'm not sure why it didn't work for you. Here is the above snippet in a short and working demo program -- it seems to work as you are requiring. I did change a few variable names below and switched WINDOW _editorWnd to WINDOW OUTPUT _editorWnd to avoid some flicking between windows as they were activated. But it's the same as before. If your program doesn't work as you say, maybe you need to look at other parts of it. Or a typo? Check carefully. Note: Part of the demo displays each instruction line after getting it from the edit field. There also is a 1 second delay between instructions to allow one to see its steps more easily. PS - What happens (and what should happen) when the user tries to PRINT before making a window? What checks and actions are needed in your program logic? PPS - The sample is a short demo to test one or two of your HBASIC instructions. You may want to use something like this to test other instructions before incorporating them in your larger project. PPPS - Also included is one method of creating windows (with id #s 1-9) that are offset by 24 points from each other. PPPPS - If you switch to using local functions for interpreting each instruction, then some of the variables like your user's output window number will have to be global variables so they can be referenced in different functions. HTH -Stu Demo Program follows... ====================================================== // DEMO PROGRAM FOR BH - Jan. 11, 2006 - FB Digest // Testing code to interpret his WIN# and PRINT commands. // DIM wnumx, wtx$ DIM lineNum DIM AS STR255 lineStr DIM SampleInstructions$ DIM ws SampleInstructions$ = "WIN# 2,Test Window 2" + CHR$(13) SampleInstructions$ += "PRINT A Horse, a Horse ..." + CHR$(13) SampleInstructions$ += "WIN# 7,Test Window 7" + CHR$(13) SampleInstructions$ += "PRINT My Kingdom for a horse" + CHR$(13) _editorWnd = 99 _cInstrFld = 1 WINDOW _editorWnd, "EDITOR", (50,50)-(450,650), 5 TEXT _Courier, 14, 1 EDIT FIELD _cInstrFld, SampleInstructions$, (25,150)-(375,575) DELAY 100 FOR lineNum = 1 to 4 ' just 4 lines in these sample instructions. DELAY 1000 ' get next instruction from the edit field lineStr = EDIT$( _cInstrFld, lineNum ) ' debugging: to verify instructions being decoded (omit later) PRINT USING "### "; lineNum; lineStr LONG IF LEFT$(lineStr,5 ) = "WIN# " wnumx = VAL( MID$(lineStr,6) ) ' Or use this version to get just one digit in 6th char. // wnumx = VAL( MID$(lineStr,6,1) ) wtx$ = MID$(lineStr,8) ws = wnumx*24 ' calc window spacing ' make the new window in offset position WINDOW wnumx, wtx$, (400+ws,100+ws)-(800+ws,500+ws), 5 WINDOW OUTPUT _editorWnd ' and return to editor window END IF LONG IF LEFT$(lineStr,6) = "PRINT " WINDOW wnumx PRINT MID$(lineStr,7) WINDOW OUTPUT _editorWnd ' and return to editor window END IF NEXT lineNum DO HandleEvents UNTIL 0 ======================================================