Here is a suggestion and is what I do: (I use ver 1.17) Make a TIMER which is only for printing to the printer. It is set for 1 second and all it does is try to print chars to the printer. When an error condition comes up, it won't print until the next second. Works ok for me.
I have a global String var called 'pr'. This is what is sent to the printer. Anywhere in any class at anytime, I can do something like pr &= "This is a new line & cr & lf when the timer fires, it tries to print some chars example something like...(not syntatically correct shown here) Sub Timer(OPTIONAL s) 'I can pass string 's' in to 'add to 'pr' and attempt print immediately DIM a AS STRING if len(s)>0 then pr &=s 'append optional s to pr if len(pr) = 0 then return 'pr has nothing..just exit 'try to print some chars 'TRY open...I have my printer open always from program start if ERROR=0 then while len(pr)>0 AND ERROR=0 a = left$(pr,20) 'I try printing 20 chars at a time TRY WRITE #hfile, a, len(a) if error=0 then 'no error, reduce pr pr=right$(pr,len(pr)-len(a) endif wend endif ERROR.clear 'TRY close end sub ---------- Original Message ----------- From: jose julio vidal <j...@2creations.com> To: mailing list for gambas users <gambas-user@lists.sourceforge.net> Sent: Thu, 08 Jan 2009 22:22:19 +0100 Subject: Re: [Gambas-user] Ask About POS Programming using Gambas > Hi! > > my code: > > .... > DIM hFile AS File > DIM txt AS String > txt=Chr$(&H1B) & "m" & Chr$(49) & Chr$(0) 'corte papel parcial > TRY hFile = OPEN "/dev/lp0" FOR WRITE > WRITE #hfile, txt > IF ERROR THEN > message.Error("No se puede acceder a la Impresora") > ELSE > END IF > .... > > regards > > El jue, 08-01-2009 a las 13:02 +0800, Leo Sendra escribió: > > Hi all, > > > > I have a problem with my POS program. I have printed a receipt through > > /dev/lp0. It works. > > But, when I want to execute a cut paper command, an error occurs. It says > > that /dev/lp0 is busy. > > I know that the printer is still printing when I execute a cut paper > > command. > > So, how to handle this error? > > I think, the solution is I have to execute a cut paper command after the > > printer stop printing. But, I don't understand the code. > > > > So, how the codes??? Help me please... > > > > > > Thanks for your help... > > > > > > > > Berbagi foto Flickr dengan teman di dalam Messenger. Jelajahi Yahoo! > > Messenger yang serba baru sekarang! http://id.messenger.yahoo.com > > ------------------------------------------------------------------------------ > > Check out the new SourceForge.net Marketplace. > > It is the best place to buy or sell services for > > just about anything Open Source. > > http://p.sf.net/sfu/Xq1LFB > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user ------- End of Original Message ------- ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user