Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Code Samples
  New Posts New Posts RSS Feed - Hello and some network printer code!
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedHello and some network printer code!

 Post Reply Post Reply
Author
Message
wdavidhicks View Drop Down
Newbie
Newbie


Joined: June 01 2004
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote wdavidhicks Quote  Post ReplyReply Direct Link To This Post Topic: Hello and some network printer code!
    Posted: June 01 2004 at 12:31pm
YeeHaw! I haven't been here for a little while. It's great to see that a forum has materialized! Thanks Mr. Schellenbach!

I think Accuterm's a great interface. Taking advantage of the scripting capabilities is a superior alternative to recoding screen draws on your already-crowded character-based apps.

Just to give this post more substance here's a nifty utility I wrote to send print jobs to network printers that support HP's PCL codes. I called it 'NWP' for NetWork Printer.

If I want a customer list on a network printer I can issue the TCL command:

NWP P 99 SORT CUSTOMERS BY NAME ID-SUPP ACCTNO NAME ADDRESS CITY

If I have a pointer-file list 'OVER90' of invoices...

NWP P 99 !OVER90 SORT INVOICES BY DUE.DATE ACCTNO CUSTOMER TOTAL AMOUNT.DUE

Page   1     CUSTOM& nbsp;        & nbsp; 16:59:34 01 Jun 2004

    NWP
001 !
002 EQU ESC TO CHAR(27)
003 TCLREAD CMD
004 ORIENT = FIELD(CMD," ",2)
005 BEGIN CASE
006 CASE ORIENT = 'L'
007 CASE ORIENT = 'P'
008 CASE 1
009   PRINT 'Usage: NWP [P/L-orientation] [form queue] [!Pointer-file list (optional)] [Tcl command]'
010   STOP
011 END CASE
012 FORM.QUE = FIELD(CMD," ",3)
013 LIST = FIELD(CMD," ",4)
014    IF LIST[1,1] = "!" THEN
015    LIST = LIST[2,99]
016    COMMAND = OCONV(CMD,"G4 999")
017    END ELSE
018    LIST = ""
019    COMMAND = OCONV(CMD,"G3 999")
020    END
021    IF ORIENT = 'L' THEN
022    EXECUTE "TERM ,,,,,,166,64";    *CPI X 10, LPI X 7
023    END ELSE
024    EXECUTE "TERM ,,,,,,125,86";    *CPI X 7.5, LPI X 9.5
025    END
026 EXECUTE "SP-ASSIGN F":FORM.QUE
027 EXECUTE "SP-OPEN"
028 PRINTER ON
029 PRINT ESC:"E":; *RESET PRINTER
030    IF ORIENT = 'L' THEN
031    PRINT ESC:"&l1O":;        *LANDSCAPE
032    END ELSE
033    PRINT ESC:"&l0O":;        *PORTRAIT
034    END
035 PRINT ESC:"&l5.33C":;     *9 LINES PER INCH
036 PRINT ESC:"(s16.66H":;    *16.6 CHARS PER INCH
037    IF LIST = "" ELSE EXECUTE "GET-LIST ":LIST
038 EXECUTE COMMAND:' (P'
039 PRINT ESC:"E":
040 PRINTER CLOSE
041 PRINTER OFF
042 EXECUTE "SP-CLOSE"

[405] 1 items listed out of 1 items.

I've coded in caps forever... it's an R83 thing...
Back to Top
Deech View Drop Down
Moderator Group
Moderator Group

Moderator -- GUI Development

Joined: December 15 2003
Status: Offline
Points: 177
Post Options Post Options   Thanks (0) Thanks(0)   Quote Deech Quote  Post ReplyReply Direct Link To This Post Posted: June 01 2004 at 6:42pm
David,

Hi, there. I'm Deech, moderator of GUI Forum. Thanks for your contribution to the code samples forum. I took a moment and edited your post to use some forum codes.

I placed your source code in a code block. If you want to do this in any post here on the forum, use "[ code ]" and "[ /code ]" without the quotes and spaces in your message text and it will put your code in window.

Again thanks for the very useful little utility.

Deech
Accuterm GUI--Changing the Face of MV Development!!
Back to Top
fjarr View Drop Down
Newbie
Newbie


Joined: May 02 2005
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote fjarr Quote  Post ReplyReply Direct Link To This Post Posted: June 23 2005 at 4:34am
I tripped across this utility. Looks useful; thanks David. The problem is it wouldn't compile on my D3 system. There seems to be a statement error in line 029. Are there some missing quotes or something around the ...&nb sp... text? Thanks.

Frank

P.S. I like your footnote about coding in upper case. I'm stuck on that habit too from my R83 days.
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: June 27 2005 at 4:21am
Hi Frank -

The "&nb sp" is html junk that crept in when entering the sample code into the forum reply window. I have edited the sample code and removed it, but I cannot get the comment to align now. But its better that the code works than if the comments line up!

Thanks and sorry for the problem,

Pete
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.