March 28, 2024, 05:33:31 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Alright.......I Give ..........Where did you hide It!

Started by charmer, September 03, 2010, 10:12:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

charmer

 ??? The last time I programmed was with QB45 many years ago and then I saw E-Basic and I thought I had a chance with it. I thought I waas doing fine till the program was susposed to print out and I found that someone had hid the LPRINT. Come on fellows...................Where am I susposed to look for it?

Charmer  ??? ??? ???

Egil

Quote from: charmer on September 03, 2010, 10:12:01 PM.....Where am I susposed to look for it?

Have you tried the Users Guide? ::) ::)

Allthough I never have used it from a console wondow, the example given there has worked fine for me, with small adjustment to serve my needs.

DEF hPrt:UINT
DEF data:STRING
DEF name:STRING
DEF pagefrom,pageto,copies,collate:INT
pagefrom = 1
pageto = 1
copies = 1
name = PRTDIALOG(NULL,pagefrom,pageto,copies,collate)
hPrt = OPENPRINTER(name,"Test Document","TEXT")
IF (hPrt)
    data = "This is a test of printing"
    data = data + chr$(13)
    data = data + "This is line 2"
    WRITEPRINTER hPrt,data
    CLOSEPRINTER hPrt
ENDIF

END


I am pretty sure that a search on the forum for 'PRINT' will give similar examples.

Good Luck!

Egil
Support Amateur Radio  -  Have a ham  for dinner!

charmer

Thank you Egil for your reply. However, I think I should try to explain. First before posting, I tried to use the Guide of your reference. In my lack of knowledge I selected a different example than you. I attempted to use Getdefaultprinter & Writeprinter and in frustration I made the post and joking referenced LPRINT which was a single word command followed by the string that was to be sent to the line printer. It was not several directives.
     I must be very inept as at your suggestion, I placed the example you showed and it would not compile. To shorten a long story I was not able to make it work. At this point I started a new program that consisted of only your example. I was unable to compile it.
     For reference, I am running V7-64 OS and the printer is an HP-7310 on my wireless network.

     I would very much appreciate anyoneââ,¬â,,¢s assistance in resolving this matter.

Thanks
        Charmer              ??? ??? ???

LarryMc

The example that Egil referenced and posted above is in error.
That example was created way back, when "data" was not a reserved keyword.

So when you compiled it for console mode you got all kinds of errors.
The giveaway was that DATA nwas in the keyword color in the IDE.

So, the help file is in error.

I modified it a little and this will compile and print to my printer just fine.

LarryMc

DEF hPrt:UINT
DEF mydata:STRING
DEF name:STRING
DEF pagefrom,pageto,copies,collate:INT
pagefrom = 1
pageto = 1
copies = 1
name = PRTDIALOG(NULL,pagefrom,pageto,copies,collate)
hPrt = OPENPRINTER(name,"Test Document","TEXT")
IF (hPrt)
print "I am printing"
    mydata = "This is a test of printing"
    mydata += chr$(13)
    mydata += "This is line 2"
    WRITEPRINTER hPrt,mydata
    CLOSEPRINTER hPrt
print "Through printing"
else
print "error opening printer"
ENDIF
print "press and key to exit"
waitcon
END
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

charmer


ckoehn

According to the manual, printers sold as "GDI only" that code will not work.  You have to use PRINTWINDOW.  It will scale the window to either portrait or landscape.

Later,
Clint

Egil

Larry is right!
By pure luck I used different variable names here, and it worked fine first try. So I never thought of the fact that data is a reserved word with EB, sorry.
I also tried PRINTWINDOW, but didn't like the results.

Egil
Support Amateur Radio  -  Have a ham  for dinner!

charmer

Larry
     I tried the code you supplied but I still have a problem. I turned off the spooler and found that the printer will not open. I added several print statements and a GETDEFAULTPRINTER and found that GETDEFAULTPRINTER and PRTDIALOG both return the same printer name. Also the added prints showed no problem down to the OPENPRINTER. Then it went to the else statement as it should have. The problem is the same when NULL is replaced with GETDEFAULTPRINTER.
     I must admit, Iââ,¬â,,¢m lost. Does anyone have any idea what to try next.
Thanks,
Charmer
??? ??? ???