Click to See Complete Forum and Search --> : Printing from within OPL
Fraser Jordan
12-19-2002, 11:35 PM
I have being trying to get print-out from within my OPL procedures for a long time without success.I have recently started using the Symbian OPL-SDK and by using LOPEN "C:file name" and LPRINT I can create/open the file and then get my output prior to printing.When I transferred the procedure to my series 5mx the printfile created was an application type file (icon with a question mark) and access was denied. Any help/advice from somebody who knows what they're doing would be most welcome. Many thanks. Fraser Jordan. Diss.Norfolk.
ktkawabe
12-20-2002, 08:45 AM
Hi Fraser,
icon depends on the programs installed on your system as well as on the actual content of the file. Even if you see the "question" icon, that merely means that the file is not recognized as the native file format of any of the installed programs, and that's OK. If "access was denied" means that when you tap the file you are told "cannot find program", then that's the normal behavior. If you mean you cannot move the file to somewhere else because the system complains the file is in use, probably you forgot to LCLOSE the file.
Anyway, LPRINT doesn't do anything but to write some byte sequence. Please try this on your 5mx:
PROC test:
LOPEN "C:\test.prt"
LPRINT "ho ho ho!"
LCLOSE
ENDP
On my 5mx this generated a 11byte file whose content is the string "ho ho ho!" (without the quotation) plus CR (0x0d) plus LF (0x0a). Depending on the applications installed on your 5mx, the icon may or may not be the question mark, and mine shows the question mark, but that's irrelevant. If the file size is 11bytes, it is quite probable that the program was executed correctly. If you have a text editor (like Symbian text editor) installed, then you can actually open the file and look inside. Please report back if this worked or not.
P.S. If you really want to use a printer, probably printer OPX is the better method.
Regards,
Keita
Fraser Jordan
12-21-2002, 02:50 AM
Hello Keita, many thanks for your response. Briefly what I'm attempting to do is get hard copy print out from my self-written surveying programs whilst working on construction sites. my hardware set up is Psion series 5mx connected by Psion parallel link cable to a Hewlett Packard deskjet 340cbi. This works perfectly to print all my word files, spreadsheets, source files etc.
I tried your suggested program and like you created an 11 byte file but again it had the question mark on its icon and when tapped produced the ever familiar "cannot open this type of file". With regards to using LCLOSE, I always shut down my program before going to the printfile for my output, and I think this is ok. I notice on my Add/Remove programs that I have SYSRAM OPX Copyright SYMBIAN 5.20 which I believe to be a collection of instructions to set up standard type printing instructions but have never dared to dive into that pool. I should add that my only source of OPL programming help are 2 books by Mike Shaw for series 3 programming which although very useful don't go very far. Happy Chrismas ! Fraser, Diss, Noofolk.
ktkawabe
12-21-2002, 04:02 PM
Hi Fraser,
nice to hear that the minimal code worked.I tried your suggested program and like you created an 11 byte file but again it had the question mark on its icon and when tapped produced the ever familiar "cannot open this type of file".As I wrote, that is perfectly normal. So now we can proceed to the next question: Do you want to directly print from your program or is it OK to simply print your file using other app?
If the latter is the case, probably the quickest way is to print from Word. Let's return to our example. We now have a text file called "c:\test.prt", right? Please open Word by tapping the silkscreen Word icon. Tap menu, and select "File" -> "More" -> "Import text file....". Then select the file c:\test.prt. The text content of your file (in this case "ho ho ho!") is inserted to Word view and you can print from there. This should always work as far as you generate plain text files using your app.
If you prefer the direct printing, then please use printer OPX that is already on ROM of your 5mx (Sysram1 OPX is not for printing). Please see your OPL SDK documentation. There should be a chapter called "OPX" where you can find all procedures offered by the OPXs on ROM.
Cheers,
Keita
Fraser Jordan
12-22-2002, 07:24 AM
Hello Keita. Many, many thanks for all your efforts in guiding me gently along the road to getting print-out from my OPL procedures. Your last response opened the final gate and now I have achieved what I first attempted to do in February 2000. I can't tell you how pleased I am. Now if only Millwall can start winning a few games !!!! Fraser. Diss. Norfolk.
ktkawabe
12-23-2002, 12:31 PM
Hi Fraser, congratulation!Now if only Millwall can start winning a few games !!!!It's a pitty that we cannot write any software to help that:D
I wish you and your football team a merry, happy and peaceful Christmas.
Keita
PDA Street
Copyright Internet.com Inc. All Rights Reserved.