IonicWind Software

IWBasic => Console Corner => Topic started by: charmer on September 03, 2010, 10:12:01 PM

Title: Alright.......I Give ..........Where did you hide It!
Post by: charmer on September 03, 2010, 10:12:01 PM
 ??? 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  ??? ??? ???
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: Egil on September 04, 2010, 02:37:19 AM
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
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: charmer on September 04, 2010, 02:46:19 PM
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              ??? ??? ???
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: LarryMc on September 04, 2010, 05:09:18 PM
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
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: charmer on September 04, 2010, 05:33:06 PM
Thanks Larry, I'll give it a try.
Charmer     :o
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: ckoehn on September 04, 2010, 05:53:32 PM
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
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: Egil on September 05, 2010, 12:18:26 AM
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
Title: Re: Alright.......I Give ..........Where did you hide It!
Post by: charmer on September 08, 2010, 08:06:15 AM
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
??? ??? ???