Issue 1 - When I try to print to printer the app dies without warning while attempting to open the printer dialog. I see the printer window open but then poof, it goes away and the app drops back into the IDE without error message.
Issue 2 - My cranial capacitor is not getting around how to call the report then print it. I have a simple report with a couple of fields that I want to populate from a calling Window. I know how to pass parameters but the print thing… how do I preview the report? And then there is issue 1.
Thanks Norman, I’ll poke at that! Let you know in a bit if it works… but… how do I write the report formatted to a file? It has one rather large image associated with it (company logo). This is a realm I have yet to delve into.
Note that a shell is NOT a “terminal window”
So one command using execute after the other behaves INDEPENDENTLY of the others
Think of it like each execute opens a terminal, runs the command, closes the terminal
The CD takes place and does its thing and the next execute behaves as if the CD was NEVER done
Change your shell to async and use the Write/WriteLine functions:
Var cmdPrn As String
Var shTerm As New Shell
shTerm.ExecuteMode = Shell.ExecuteModes.Asynchronous
// ^^^ I HATE the new API for this...
// Function(s)…
shTerm.Execute("/bin/bash -i")
shTerm.WriteLine("PS1=input:\ ") // Makes it easier to catch end of command since we can't
// depend on IsRunning using a shell in this manner
cmdPrn = “lpoptions -d EPSON_WF_7610_Series”
shTerm.WriteLine( cmdPrn )
Do
shTerm.Poll
App.DoEvents(5)
Loop Until InStrB(shTerm.Result, "input: ") <> 0
Call shTerm.ReadAll // Throw away the current text
// I believe that you probably need an lpr command around here ...
cmdPrn = “cd /Joyful\ Heart\ Garden\ Center\Gift\ Cert\ DB"
shTerm.WriteLine( cmdPrn )
Do
shTerm.Poll
App.DoEvents(5)
Loop Until InStrB(shTerm.Result, "input: ") <> 0 Or Not shTerm.IsRunning
Call shTerm.Readall
If shTerm.ErrorCode = 0 Then
MessageBox( shTerm.Result.ToText )
Else
MessageBox( "Error " + Str( shTerm.ErrorCode ) )
End If
cmdPrn = “pwd”
shTerm.WriteLine( cmdPrn )
shTerm.WriteLine( "exit" )
MessageBox( shTerm.ReadAll.ToText )
Is there a way to use a terminal window in the background? Right now my solution is to write a bash script to do everything I want then invoke it from shell… what’s your opinion? Funny thing is I still haven’t broached writing a formatted document! Which brings up… can I write a file out as a pdf from xojo? Or is there some other magic required?
The above image is an OpenOffice spreadsheet with two sheets, the final which you see and the “source” worksheet. Right now I create the gift certificate information with my application and write the required data to disk, open the text file created and copy paste the output into the "source’ worksheet then print the Gift Certificate worksheet.
Originally I wanted to write the data directly into an OpenOffice spreadsheet and print from there, but I haven’t heard any replies as to if that is possible. This is all new territory for me as most of my programs have been pretty simple and for my use. But this is for some pretty techtarded folks and I am building it as reliable and simple to use as possible. Basically making it so a cavechimp could run it.
ok to run the bash script you dont need a “terminal” since the bash script would be one command run by a shell
Xojo does not directly have any built in means to write a PDF
There are other ways to do this ranging from free to expensive and they come with varying ranges of capabilities (which you might expect)
I know some have used
wkhtmltoPDF which is a small app that lets you write HTML that it converts to a PDF
Einhugurs PDF plugin (the Excel one might be useful)
There are others as well by google foo just isnt finding them right now
Normally I’d say "oh just draw that but since open printer etc fails spectacularly on Linux thats not really an option
[quote=“John_McDonald, post:7, topic:55253, full:true”]Originally I wanted to write the data directly into an OpenOffice spreadsheet and print from there, but I haven’t heard any replies as to if that is possible.
[/quote]
it might be but I’ve never experimented with it so really dont know for sure