Hi, I have switched over to using CASEs But now the PRINT command only works once and after that I get UNKNOWN INSTRUCTION on Line #2 CASE "PRINT" // WINDOW wnumx WINDOW OUTPUT wnumx PRINT restOfLine$ Here's the full code: RESOURCES "HBasic.rsrc","APPLHBas" COMPILE 0, _strResource /* '~'A ' Runtime : Rntm Appearance.Incl ' Debugger : Off ' CPU : Carbon ' CALL Req'd : Off ' No Re-DIM'd Vars : On ' DIM'd Vars Only : On ' Debug Labels : On ' QB Labels : Off ' Optimize STR# : On ' Ary Bounds Checking : On ' Show Warnings : Off ' Register Vars : On ' Make Line Start Table : Off '~'B FB code generated by TWM (The Window Maker) <http://homepage.ntlworld.com/bernie.w/twmad.htm> Portions generated & © 2005 by TWM/Bernie Wylde Portions © 2005 by Stu Cram Portions © 2005 by Al Stafferri Jr. Portions © 2005 by various contributers on the FB list Portions © 2005 & 2006 by Brian Heibert */ KILL RESOURCES "ICN#",130 KILL RESOURCES "icl4",130 KILL RESOURCES "icl8",130 KILL RESOURCES "ics4", 128, "ics4",129, "ics8",128,"ics8",129,"ics8",130 KILL RESOURCES "FB3a",0 KILL RESOURCES "icm#",128, "icm#", 129, "icm4",128, "icm4",129 KILL RESOURCES "icm8", 128, "icm8",129, "icns",128 APPLE MENU "<BAbout HBasic...;About this Program..." edit menu 2 menu 2,7,1, "-" menu 2,8,1, "/ASelect All" menu 3,0,1, "Command" menu 3,1,1, "<B/RRun..." menu 3,2,1, "<I/BBuild Application..." num = 0 _mFile = 1 _iNew = 1 _iLine = 2 _iOpen = 3 _iMerge = 4 _iClose = 5 _iSaveAs = 7 _iSave = 8 //_iMerge = 9 _iPageSetup = 11 _iPrint = 12 menu _mFile,0,_Enable, "File" menu _mFile,_iNew,_Enable, "<B/NNew Program" menu _mFile,2,_Enable, "-" menu _mFile,_iOpen,_enable, "/OOpen..." menu _mFile,4,_enable, "-" menu _mFile,_iClose,_enable, "/WClose Window" menu _mFile,6,_enable, "-" menu _mFile,_iSaveAs,_enable, "Save Program as..." menu _mFile,_iSave,_enable, "/SSave Program" menu _mFile,_iMerge,_enable, "Merge..." menu _mFile,10,_enable, "-" menu _mFile,_iPageSetup,_enable, "Page Setup..." menu _mFile,_iPrint,_enable, "/PPrint..." DIM AS INT OSErr, @firstCustomHelpItem DIM AS HANDLE @hmHandle #If CarbonLib OSErr = FN HMGETHELPMENU(hmHandle,firstCustomHelpItem) #ELSE OSErr = FN HMGETHELPMENUHANDLE(hmHandle) firstCustomHelpItem = FN COUNTMITEMS(hmHandle)+1 #EndIf CALL APPENDMENU(hmHandle,"<B/?HBasic Help...") CALL APPENDMENU(hmHandle,"-") CALL APPENDMENU(hmHandle,"/1Programming Manual") CALL APPENDMENU(hmHandle,"/2HBasic on the Web") include "Tlbx SpeechSynthesis.Incl" Include "Subs AppleScript.Incl" #if CarbonLib = _false compile shutdown "HBasic only works in Carbon OSX" #endif LOCAL FN doBreak dim i CALL PARAMTEXT("","","","") i = FN STOPALERT (131,0) dim cancel IF i = 2 then cancel = _ztrue IF i = 1 then end END FN on break fn doBreak #IF cpuPPC <> 0 #If CarbonLib = 0 Library "ICAp;InternetConfigLib" #Endif #Define ICError As Long #Define ICInstance As Pointer Begin Record ICDirSpec Dim vRefNum As Short Dim dirID As Long End Record #Define ICDirSpecArrayPtr As Pointer To ICDirSpec Toolbox Fn ICStart(ICInstance * inst, OSType signature) = OSStatus Toolbox Fn ICLaunchURL(ICInstance inst, Str255 hint, Ptr * theData, Long length, Long * selStart, Long * selEnd) = OSStatus `0x2F3C, 0x0014, 0x0011, 0x7000, 0xA82A Toolbox Fn ICStop(ICInstance inst) = OSStatus #If CarbonLib = 0 Toolbox Fn ICFindConfigFile(ICInstance inst, Short count, ICDirSpecArrayPtr folders) = OSStatus `0x2F3C, 0x0006, 0x0002, 0x7000, 0xA82A Library #Endif '~'1 Clear Local Mode Local Fn GetMyCreator Dim creator As OSType Dim psn As ProcessSerialNumber Dim info As ProcessInfoRec Dim fSpec As FSSpec Dim appName As STR63 creator = _"????" Long If Fn GetCurrentProcess( psn ) = _noErr info.processInfoLength = 60 info.processName = @appName info.processAppSpec = @fSpec Long If Fn GetProcessInformation( psn, info ) = _noErr creator = info.processSignature End If End If End Fn = creator '~'1 Clear Local Mode Local Fn LaunchURL( @urlStr As ^Str255 ) Dim As Long err,junk,@ startSel,endSel Dim As ICInstance @ inst err = Fn ICStart( inst, Fn GetMyCreator ) Long If err = _noErr #If CarbonLib = 0 err = Fn ICFindConfigFile( inst, 0, _nil ) #Endif Long If err = _noErr startSel = 0 endSel = urlStr.nil$[0] err = Fn ICLaunchURL(inst,":",@urlStr.nil$[1],urlStr.nil $[0],startSel,endSel) End If junk = Fn ICStop( inst ) 'If err Then Stop "InternetConfig Error"+Str$(err) End If End Fn = err 'Fn LaunchURL("file:///Macintosh HD/test.html") #ENDIF LOCAL FN STRINGALERT1 (sal$) sal$ = MID$(restOfLine$,13) CALL PARAMTEXT (sal$,"","","") i = FN ALERT (128,0) EXIT FN END FN LOCAL FN NOTEALERT1 (MSG$) 'nla$ = MID$(lineStr,11) //msg$ = MID$(lineStr,11) CALL PARAMTEXT(MSG$,"","","") i = FN NOTEALERT (128,0) END FN LOCAL FN CAUTIONALERT1 (MSG$) CALL PARAMTEXT (MSG$,"","","") i = FN CAUTIONALERT (128,0) 'EXIT FN END FN LOCAL FN STOPALERT1 (MSG$) CALL PARAMTEXT (MSG$,"","","") i = FN STOPALERT (128,0) END FN LOCAL FN SPEAKABLEALERT (spAL$) MSG$ = spAL$ CALL PARAMTEXT (MSG$,"","","") i = FN ALERT (128,0) err = FN SPEAKSTRING (MSG$) END FN LOCAL FN ALERT1 (MSG$) CALL PARAMTEXT (MSG$,"","","") i = FN ALERT (128,0) END FN LOCAL FN ALERT2 (MSG$) CALL PARAMTEXT (MSG$,"","","") i = FN ALERT (128,0) END FN dim xi,sst sst = SYSTEM(_sysVers) long if system(_sysvers) <1030 CALL PARAMTEXT ("","","","") xi = FN STOPALERT (141,0) end end if dim stwelcome$,ans$,ans1$,sfl,wtxt$ stwelcome$ = STR#(128,1) Long if system(_macPlus) = _ztrue CALL PARAMTEXT("","","","") xi = FN STOPALERT (140,0) end end if 'speak stwelcome1$ = "Welcome to HBasic" dim ii,err err = FN speakString (stwelcome1$) CALL PARAMTEXT ("","","","") ii = FN ALERT (129,0) DIM x CALL PARAMTEXT ("","","","") x = FN ALERT (137,0) //Shareware Notice clear local #if ndef _gestaltSpeechMgrPresent _gestaltSpeechMgrPresent = 0 #endif local fn hasSpeechMgr' returns non-zero if Speech Mgr present dim @ speechAttr as long end fn = fn Gestalt(_"ttsc",speechAttr) = _noErr and (speechAttr and _gestaltSpeechMgrPresent%) Local Fn AnswerRequest( @instruction As .Str255 ) Dim As Str255 request, answer Dim As Handle resultHndl //Dim As OSErr err Long If instruction.1& =_"INPU" request = instruction.0$ request[6] = instruction.0`- 6 request = Pstr$(@request[6]) Route _toAppleScript Print "display dialog """""+request+""""" default answer """"" Print "return text returned of result" Route _toScreen err = Usr AppleScriptRun( answer ) resultHndl = Usr AppleScriptGetResult Long If err = _noErr answer[1] = answer[0]-2 answer = Pstr$(@answer[1]) Print answer End If End If End Fn begin enum 1 _Editor end enum begin enum 1 _cEdit _cScroll end enum #define FMFontFamily as SInt16 toolbox fn FMGetFontFamilyFromName(Str255 iName) = FMFontFamily xnum = +1 local fn BuildEditor dim as ControlFontStyleRec tfs dim as WindowAttributes wa dim as Rect r '~'< wa = _kWindowCloseBoxAttribute¬ _kWindowCollapseBoxAttribute SetRect(r, 0, 0, 635, 480)// Optional FB auto-centre //SetRect(r, 58, 128, 692, 608)// w: 640 h: 480 dim wt$ appearance window -_Editor,¬ wt$, @r,¬ _kDocumentWindowClass, wa def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue) '~'< SetRect(r, 0,0, 619, 471) s$ = "" color _zBlue edit field _cEdit, s$, @r, _framed_noDrawFocus, _leftJust edit text #_cEdit, fn FMGetFontFamilyFromName("Courier"), 13 text _Courier,13 SetRect(r, 619, 3, 634, 472) scroll button -_cEdit,0,0,0,0, @r, _scrollOther SetRect(r, 625, 1, 640, 474) //appearance button _cScroll,¬ // _activeBtn, 0, 0, 100,, @r,¬ // _kControlScrollBarProc //xnum = xnum + 1 wt$ = "HBasic ( "+xnum+ " )" appearance window _Editor, wt$ end fn local fn Init fn BuildEditor end fn FN init '~dims dim wnum,wtit$ dim rs$,nl1$ DIM gt1,gt2 DIM gt2$,gt3,c DIM crsr DIM sal$ DIM sxi$ DIM asc1$ DIM fsz dim wnumx,wtx$ dim wnumxNumber local fn ParseEFLines( efID as long ) // Obtain handle to selected edit field dim type,wd,wtype // Test for valid handle DIM efHndl&, dataLine$, lineNum DIM spacePosition DIM keyWord$, restOfLine$ DIM nmu efHndl& = TEhandle( _cEdit ) FOR lineNum = 1 TO efHndl&..TEnLines% dataLine$ = EDIT$( _cEdit, lineNum ) spacePosition = INSTR(1, dataLine$+" "," ") keyword$ = LEFT$(dataline$,spacePosition-1) restOfLine$ = MID$(dataLine$,spacePosition+1) SELECT UCASE$( keyWord$ ) /* CASE "WIN" dim wnumx,wtx$ dim wnumxNumber dim wnumx,wtx$ dim wnumxNumber wnumx = VAL( MID$(restOfLine,5) ) wtx$ = MID$(restOfLine$,7) WINDOW _editor // and return to editor window CASE "PRINT;" nl$ = MID$(restOfLine$, 8) WINDOW OUTPUT wnumx PRINT nl$; */ '-- CASE "WIN#" ' this uses your previous code: or better; make a FN to do it. wnumx = VAL( LEFT$(restOfLine$,1) ) wtx$ = MID$(restOfLine$,3) ws = wnumx*24 ' calc window spacing ' make the new window in its offset position WINDOW wnumx, wtx$, (400+ws,100+ws)-(800+ws,500+ws), 5 // WINDOW wnumx, wtx$ // make the new window WINDOW OUTPUT _editor ' return to editor window CASE "PRINT" ' this uses your previous code: or better; make a FN to do it. WINDOW wnumx WINDOW OUTPUT wnumx PRINT restOfLine$ CASE "?" WINDOW wnumx WINDOW OUTPUT wnumx PRINT restOfLine$ '-- CASE "PRINT¬" //nl1$ = MID$(restOfLine$,6) //WINDOW OUTPUT wnumx //PRINT nl1$; '-- WINDOW OUTPUT wnumx PRINT restOfLine$ WINDOW OUTPUT _editor ' return to editor window '- '-- CASE "PRINTNUM" WINDOW OUTPUT wnumx numv = VAL(restOfLine) PRINT numv CASE "VAL" vl = VAL(MID$(restOfLine$,0)) final = VAL(restOfLine$) WINDOW OUTPUT wnumx PRINT final CASE "LETA" gt1 = VAL (restOfLine$) CASE "LETB" //gt2 = VAL(MID$(restOFLine$,6)) gt2 = VAL (restOfLine$) CASE "LETAOUTPUT" WINDOW OUTPUT wnumx PRINT gt1 CASE "LETBOUTPUT" WINDOW OUTPUT wnumx PRINT gt2 CASE "ADDLET" LET C = gt1+gt2 WINDOW OUTPUT wnumx PRINT C CASE "SUBTRACTLET" LET C = gt1-gt2 WINDOW OUTPUT wnumx PRINT C CASE "MULTIPLYLET" LET C = gt1*gt2 WINDOW OUTPUT wnumx PRINT C CASE "DIVIDELET" LET C = gt1/gt2 WINDOW OUTPUT wnumx PRINT C CASE "STR" ls$ = MID$(restofLine$,5) final$ = ls$ WINDOW OUTPUT wnumx WINDOW wnumx TEXT wfid CASE "STR$=" stxt1$ = restOfLine CASE "PRINTSTR" PRINT final$ CASE "//" 'do nothing CASE "ARROWCURSOR" CURSOR _arrowCursor DELAY 2000 CASE "WATCHCURSOR" CURSOR _watchcursor DELAY 2000 CASE "TEXTCURSOR" CURSOR _iBeamCursor DELAY 2000 CASE "CROSSCURSOR" CURSOR _crossCursor DELAY 2000 CASE "PLUSCURSOR" CURSOR _plusCursor DELAY 2000 CASE "HANDCURSOR" CURSOR 128 DELAY 2000 CASE "POINTERCURSOR" CURSOR 129 DELAY 2000 CASE "STRING$=" sxi$ = restOfLine '-- /* LONG IF left$(restOfLine,9) = "STRING$= " sxi$ = MID$(restOfLine,10) beep END IF */ '-- CASE "PSTR$" WINDOW OUTPUT wnumx TEXT wfid PRINT sxi$ CASE "SSTR$" long if fn hasSpeechMgr err = fn SpeakString (sxi$) while fn SpeechBusy wend xelse beep end if CASE "CSTR$" PRINT sxi$ long if fn hasSpeechMgr err = fn SpeakString (sxi$) while fn SpeechBusy wend xelse beep end if CASE "PRINTSTRING$" WINDOW OUTPUT wnumx TEXT wfid PRINT sxi$ CASE "ALERTSTR$" CALL PARAMTEXT (sxi$,"","","") i = FN ALERT (147,0) CASE "GET" gt$ = restOfLine WINDOW OUTPUT wnumx PRINT gt$+" "; INPUT "";ans$ CASE "PGET" WINDOW OUTPUT wnumx PRINT ans$ CASE "USERASK" // not developed yet CASE "INPUT" errx$ = STR#(128,4) //errx$ = "INPUT,INPUT$, USERASK have been replaced with GET & PGET." CALL PARAMTEXT ("","","","") i = FN ALERT(149,0) CASE "INPUT$" errx$ = STR#(128,4) //errx$ = "INPUT,INPUT$, USERASK have been replaced with GET & PGET." CALL PARAMTEXT ("","","","") i = FN ALERT(149,0) CASE "ASC" asc1$ = MID$(restOfLine,4) WINDOW OUTPUT wnumx PRINT ASC(asc1$) CASE "NOTEALERT" MSG$ = restOfLine$ FN NOTEALERT1 (MSG$) CASE "CAUTIONALERT" MSG$ = restOfLine$ FN CAUTIONALERT1 (MSG$) CASE "STOPALERT" MSG$ = restOfLine$ FN STOPALERT1 (MSG$) CASE "SPEAKABLEALERT" spAL$ = restOfLine$ MSG$ = spAL$ FN SPEAKABLEALERT (MSG$) CASE "SPEAKABLECAUTIONALERT" long if fn hasSpeechMgr err = fn SpeakString (restOfLine$) while fn SpeechBusy wend FN CAUTIONALERT1 (restOfLine$) xelse beep end if CASE "ALERT" alx2$ = (restOfLine$) FN ALERT2 (alx2$) CASE "INPUT" errx$ = STR#(128,4) //errx$ = "INPUT,INPUT$, USERASK have been replaced with GET & PGET." CALL PARAMTEXT (errx$,"","","") i = FN ALERT(128,0) CASE "INPUT$" errx$ = STR#(128,4) //errx$ = "INPUT,INPUT$, USERASK have been replaced with GET & PGET." CALL PARAMTEXT (errx$,"","","") i = FN ALERT(128,0) CASE "ASC" asc1$ = restOfLine$ WINDOW OUTPUT wnumx PRINT ASC(asc1$) CASE "LAUNCHURL" url$ = restOfLine$ Fn LaunchURL(url$) CASE "MAILTO" url$ = "MAILTO:"+restOfLine$ Fn LaunchURL (url$) CASE "LAUNCHURL(FROMSTRING)" IF sxi$ = "" THEN BEEP Fn LaunchURL (sxi$) CASE "MAILTO(FROMSTRING)" IF sxi$ = "" THEN BEEP Fn LaunchURL ("mailto:"+sxi$) CASE "AOL:" fn LaunchURL ("AOL:"+restOfLine$) CASE "EASTEREGG" CALL PARAMTEXT("Suprise! Gotcha","","","") i = FN ALERT (132,0) CASE "VOICE(EASTEREGG)" err = FN speakString ("Suprise! Gotcha") CASE "SPEAKSTRING" long if fn hasSpeechMgr err = fn SpeakString (stxt1$) while fn SpeechBusy wend xelse beep end if CASE "PRINTSTRING" WINDOW OUTPUT wnumx PRINT stxt1$ CASE "SPEAK" long if fn hasSpeechMgr err = fn SpeakString (restOfLine$) while fn SpeechBusy wend xelse beep end if CASE "TALK" long if fn hasSpeechMgr err = fn SpeakString (restOfLine$) while fn SpeechBusy wend xelse beep end if CASE "EXITTOSHELL" EXITTOSHELL CASE "SHUTDOWN" SHUTDOWN CASE "SHUTDOWN$" SHUTDOWN restOfLine$ CASE "TIMER" wt = restOfLine DELAY wt CASE "PAUSE" wt = restOfLine DELAY wt CASE "WAIT" wt = restOfLine DELAY wt CASE "UCPRINT" dim UC$ UC$ = UCASE$(restOfLine$) WINDOW OUTPUT wnumx PRINT UC$ CASE "LCPRINT" dim LC$ LC$ = restOfLine$ DEF LCASE( LC$) WINDOW OUTPUT wnumx PRINT LC$ CASE "FSIZE" fsz = VAL(restOfLine) WINDOW OUTPUT wnumx TEXT ,fsz WINDOW _editor CASE "SYSTEM" SYSTEM CASE ELSE CALL PARAMTEXT ("Unknown Instruction on line#:"+STR$(lineNum), dataLine$, "","") i = FN ALERT (148,0) END SELECT NEXT lineNum end fn //end if //end if //end fn txt2$ = EDIT$(_cEdit) DIM AS DOUBLE num1, num2 DIM AS STR255 txt1, txt2 DIM AS STR255 filename local fn fileError2 CALL PARAMTEXT("","","","") i = FN STOPALERT (135,0) End FN local fn fileError1 CALL PARAMTEXT ("","","","") i = FN STOPALERT (134,0) END FN LOCAL FN HandlesX Dim @EditH As Handle Dim FileName //As Str63 Dim @Vol As Int END FN //override runtime FBDefaultErrorHandler //end fn local fn DoMenu dim as long menuID, itemID menuID = menu(_menuID) itemID = menu(_itemID) num = num +1 dim @refNumVar% select case( menuID ) case _mFile select (itemID) case _iNew '-- new ' find out how to tell if visible this is just a guess //Dim WindowRef @ wndRef& //wndRef = 1 //wndRef& = 1 DIM @wndRef1& Get Window wndNum, wndRef1& long if FN IsWindowVisible (wndRef1&) window close #_Editor xnum = num+ 1 //wt$ = "HBasic ( "+xnum+" )" xelse //what to do here? //xnum = xnum + 1 edit field _cEdit, "" menu //wt$ = "HBasic ( "+xnum+" )" window close #_Editor window close #1 xnum = xnum + 1 wt$ = "HBasic ("+xnum+")" fn buildEditor end if //num = num+1 case _iPageSetup DEF PAGE IF PRCANCEL = _False then beep case _iPrint DEF PRINTEDITFIELD(_cEdit) case _iOpen /* DIM fo1$ menu DEF OPEN "HBSf" dim wxn$,wt$ fo1$ = FILES$(_fOpen, "HBSf","Open HBasic file...",refNumVar%) if fo1$ = "" then beep: FN fileError2:EXIT FN wxn$ = "HBasic: "+fo1$+ " ( "+xnum+" ) " WINDOW #_Editor, fo1$+" - HBasic" wt$ = "HBasic ( "+xnum+" )" OPEN "R",2,fo1$'I 'LINE INPUT #2, txt$ //PRINT #1, txt$ READ #2, txt$ EDIT FIELD _cEdit,txt$ */ TEXT _Courier,13 DIM fileName$, refNumvar%, dataLine$ fileName$ = FILES$(_fopen, "HBSf", "Select a file:", refNumvar% ) IF fileName$ = "" THEN fn fileError2:EXIT FN OPEN "I", 2, fileName$, ,refNumVar% // clear previous contents of edit field TEXT _Courier,13 EDIT$( _cEdit ) = "" TEXT _Courier,13 // repeat loop while not End Of File WHILE NOT EOF( 2 ) // get the next line of text (up to 'return') LINE INPUT #2, dataLine$ // append it to end of info in edit field (with a 'return') TEXT _Courier,13 EDIT$( _cEdit, _maxInt,_maxInt ) = dataLine$ + chr$(13) WEND CLOSE #2 // set cursor at end of edit field's info SetSelect _maxInt, _maxInt WINDOW _Editor, "HBasic - "+filename$ Case _iClose wt1$ = wt$ + " "+STR$(xnum) CALL PARAMTEXT (wt1$,"","","") cli = FN ALERT (142,0) long if cli = 4 window close #_Editor xelse 'do nothing end if menu case _iSave menu dim ed$ dim fo$,txt$ txt$ = EDIT$(_cEdit) DIM fileName$, refNumVar% DIM efHndl&, dataLine$, lineNum //DEF OPEN "HBSfHBas" fo$ = FILES$(_fSave,"Save HBasic file as...","New Program.HBSf",refNumVar%) IF fo$ = "" then beep:FN fileError1:EXIT FN DEF OPEN "HBSf" OPEN "O", 1, fo$, ,refNumVar% efHndl& = TEhandle( _cEdit ) FOR lineNum = 1 TO efHndl&..TEnLines% dataLine$ = EDIT$( _cEdit, lineNum ) PRINT #1, dataLine$ NEXT lineNum CLOSE #1 WINDOW _Editor, "HBasic - "+fo$ //PRINT #1, txt$ //CLOSE #1 menu case _iSaveAs menu dim ed$ dim fo$,txt$ txt$ = EDIT$(_cEdit) DIM fileName$, refNumVar% DIM efHndl&, dataLine$, lineNum //DEF OPEN "HBSfHBas" fo$ = FILES$(_fSave,"Save HBasic file as...","New Program.HBSf",refNumVar%) IF fo$ = "" then beep:FN fileError1:EXIT FN DEF OPEN "HBSf" OPEN "O", 1, fo$, ,refNumVar% efHndl& = TEhandle( _cEdit ) FOR lineNum = 1 TO efHndl&..TEnLines% dataLine$ = EDIT$( _cEdit, lineNum ) PRINT #1, dataLine$ NEXT lineNum CLOSE #1 WINDOW _Editor, "HBasic - "+fo$ case _iMerge 'put merge code here merge$ = EDIT$(_cEdit) 'begin merge TEXT _Courier,13 DIM fileName$, refNumvar%, dataLine$ fileName$ = FILES$(_fopen, "HBSf", "Select a file:", refNumvar% ) IF fileName$ = "" THEN fn fileError2:EXIT FN OPEN "I", 2, fileName$, ,refNumVar% // clear previous contents of edit field TEXT _Courier,13 EDIT$(_cEdit) = EDIT$(_cEdit)+ EDIT$(_cEdit, _maxInt,_maxInt) + dataLine+ chr$(13) TEXT _Courier,13 // repeat loop while not End Of File WHILE NOT EOF( 2 ) // get the next line of text (up to 'return') LINE INPUT #2, dataLine$ // append it to end of info in edit field (with a 'return') TEXT _Courier,13 EDIT$( _cEdit, _maxInt,_maxInt) = dataLine$ WEND CLOSE #2 // set cursor at end of edit field's info SetSelect _maxInt, _maxInt WINDOW _Editor, "HBasic - "+filename$ 'end merge end select case 2 select (itemID) case 8 SetSelect 0,32767 end select case 3 select (itemID ) case 1 fn ParseEFLines(_cEdit ) menu case 2 appearance window -_Editor fo$ = FILES$(_fSave,"Save new application as...","New Program.app",refNumVar%) IF fo$ = "" then beep:FN fileError1:EXIT FN OPEN "O", 1, fo$, ,refNumVar% CLOSE #1 WINDOW _Editor, "HBasic - "+fo$ fn ParseEFLines (_cEdit) end select case _kHMHelpMenuID select itemID case 1 // 1 = HBasic Help case 3 // 3 = Programming Manual hbasicmanual$ = "http://www.hbasic.com/manual/" Fn LaunchURL (hbasicmanual$) case 4 // 4 = HBasic on the Web hbasicweb$ = "http://www.hbasic.com/" Fn LaunchURL(hbasicweb$) end select case _applemenu select( itemID ) case 1 dim i 'speak err = FN speakString ("Welcome to HBasic") CALL PARAMTEXT ("","","","") i = FN ALERT (129,0) ix = FN ALERT (137,0) case 2 'about CALL PARAMTEXT (abt$,"","","") i = FN ALERT (136,0) case 3 dim sp select( itemID ) case 3 : def fn quitprocedure: fn quitprocedure'gFBQuit = _zTrue end select case else select (itemID) case else def fn quitprocedure fn quitprocedure end select menu end select end select menu end fn DIM cli Local fn DoDialog dim as long evnt, id evnt = dialog(0) id = dialog(evnt) select case( evnt ) case _wndClose select( id ) case 1 CALL PARAMTEXT (wt$,"","","") cli = FN ALERT (142,0) long if cli = 4 window close #_Editor menu xelse 'do nothing menu end if end select end select end fn local fn quitprocedure CALL PARAMTEXT (wt$,"","","") cli = FN ALERT (142,0) long if cli = 4 end xelse 'do nothing menu end if end fn ON MENU FN DoMenu ON DIALOG FN DoDialog IF gFBQuit = _zTrue then fn quitprocedure menu do handleevents until gFBQuit