[Gambas-user] Very strange printing problem + SHELL

Benoit Minisini benoit.minisini at ...2...
Wed May 3 10:46:49 CEST 2006


On Wednesday 03 May 2006 09:52, Eilert wrote:
> Hi everybody,
>
> After having been searching for this bug for months, I've found it at last.
>
> In one of my apps, when the user makes an entry into a customer's
> account for instance and has it saved, the program won't print anymore.
> The printing dialog appears, and everything runs through as expected,
> but there is no output to the printer. If I restart the program, it will
> print as usual.
>
> Now, this appears to be the reason:
>
> In the saving SUB I found I had included a SHELL command changing the
> file's mode to 660 after writing so every member of the group can write
> into this file.
>
> When I comment this SHELL command out, the app runs as expected. As soon
> as it is activated, however, the bug appears: Whenever the SHELL is
> called, printing will fail afterwards.
>
> Here is one of the critical parts in code:
>
>    OPEN datei$ & "konto" FOR WRITE CREATE AS #dtnr
>      FOR i = 0 TO ktNr.Count - 1
>        IF ktModus[i] = "N" THEN BREAK
>        PRINT #dtnr, "    account" & Chr$(13)
>        PRINT #dtnr, "        number=" & CStr(i + 1) & Chr$(13)
>        PRINT #dtnr, "        date=" & SpeicherDatum(ktDatum[i]) & Chr$(13)
>        PRINT #dtnr, "        text=" & Str2Tag(ktText[i]) & Chr$(13)
>        PRINT #dtnr, "        debit=" & ktSoll[i] & Chr$(13)
>        PRINT #dtnr, "        credit=" & ktHaben[i] & Chr$(13)
>        PRINT #dtnr, "        mode=" & SpeicherModus(ktModus[i]) & Chr$(13)
>        PRINT #dtnr, "    end account" & Chr$(13)
>        PRINT #dtnr, " " & Chr$(13)
>      NEXT
>    CLOSE #dtnr
>    SHELL "chmod 660 " & datei$ & "konto" WAIT
>
> Does anyone here have an idea why this SHELL line might keep the printer
> from printing? Is there another way of having the chmod 660? Or did I
> implement the SHELL command wrong?
>
> Thanks for all ideas!
>
> Rolf
>

I think there is a clash between interpreter process management and qt process 
management, used for running 'lpr'.

Try to print to a postscript file, and send this file to the printer with 
SHELL or EXEC. It should work.

Regards,

-- 
Benoit Minisini





More information about the User mailing list