From: Tom Porcher Subject: PostScript program to make labels for X-10 transmitters... Date: 09 Mar 1999 00:00:00 GMT Message-ID: <36E5273D.1DC22617@acm.org> Sender: porcher@207.221.172.11 X-Ultra-Time: 9 Mar 1999 13:51:20 GMT Content-Type: multipart/mixed; boundary="------------91C7D88FF22B67BB32CD2DED" X-Complaints-To: abuse@ultra.net Organization: UltraNet Communications , an RCN Company http://www.ultranet.com/ Mime-Version: 1.0 Newsgroups: comp.home.automation This is a multi-part message in MIME format. --------------91C7D88FF22B67BB32CD2DED Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit For those of you with PostScript printers, the attached PostScript program will create custom labels for your X-10 transmitters: maxi controllers, mini controllers, old home computer interface (CP290), Palm Pads, old radio controllers. If there's one that's missing, you can add it :-} (let me know if you do). The original program predates MS Windows, which has never provided an easy way to get PostScript to a PostScript printer. Unix, Mac, NeXT, etc. users shouldn't have any problems. Under MS Windows 9X, you can send it to your printer with a DOS box and using the command: F:\> copy x10-labels.ps+EndOfJob.ps prn: How to send PostScript on MS Windows NT is left as an exercise for the reader :-{. As configured, this program will fill an 8.5 x 11 page with an assortment of labels. You can change the "xxcopies" definitions to suit your needs. The actual label text is in the procedure "labelproc" with examples on how to put in your own text. Enjoy! --Tom Porcher (porcher@acm.org) --------------91C7D88FF22B67BB32CD2DED Content-Type: application/postscript; name="x10-labels.ps" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="x10-labels.ps" %!PS-Adobe-3.0 % % x10-labels.ps - makes labels for X-10 mini, maxi, radio, palm pad, and % home computer interface controllers % V3.4 % % Copyright (c) 1990, 1999 Tom Porcher % Permission is granted to distribute, copy, and/or modify for % personal use only. % % Author: Tom Porcher (porcher@acm.org) % % % customize "labelproc" and "xxxcopies" below. % % will print copies of each on 8.5 x 11 paper. % % xxxboxwidth, xxxboxheight, xxxwidth, xxxheight % may be adjusted slightly for your printer if necessary. % inchpoint may be adjusted to scale all measurements. % number of copies of ... /maxicopies 2 def % new maxi controller labels /oldmaxicopies 1 def % old maxi controller labels /minicopies 6 def % mini controller labels /rccopies 3 def % old radio control labels /ppcopies 5 def % palm pad labels /hcicopies 2 def % home computer interface (CP290) labels /pagecopies 0 def % full page chart /labelproc { % labelproc - actual label text % % format-- one of the following: % (one line) showunit % (first line) (second line) showunit % ( ) showunit % placeholder, prints unit # % showuint % placeholder, does not print unit # % % Include one showunit for every unit from 1 to the highest unit # used. (North) (bedroom) showunit % 1 ( ) showunit % 2 (Deck) showunit % 3 (2nd floor) (thermostat) showunit % 4 (Living rm) (floor lamp) showunit % 5 (Living rm) (table lamp) showunit % 6 (Study) showunit % 7 (1st floor) (thermostat) showunit % 8 (South) (bedroom) showunit % 9 (Xmas tree) showunit % 10 (Shed) showunit % 11 ( ) showunit % 12 (Master) (bedroom) showunit % 13 (Window) (candles) showunit % 14 ( ) showunit % 15 (Addition) (thermostat) showunit % 16 } def % general size measurements -- per unit box (or total box) in inches /inchpoint 72 def % points per inch - 72 is default /maxiwidth 0.64 inchpoint mul def /maxiheight 0.44 inchpoint mul def /maxiboxwidth 5.35 inchpoint mul def /oldmaxiwidth 0.7 inchpoint mul def /oldmaxiheight 0.5 inchpoint mul def /miniwidth 0.59 inchpoint mul def /miniboxheight 0.81 inchpoint mul def /rcwidth 0.80 inchpoint mul def /rcheight 0.21 inchpoint mul def /rcboxheight 4.06 inchpoint mul def % palm pad uses rcwidth & rcheight /ppboxyoffset 0.15 inchpoint mul def /ppboxheight 3.70 inchpoint mul def /hciwidth 0.83 inchpoint mul def /hciheight 0.22 inchpoint mul def /pagewidth 8.5 inchpoint mul def /pageheight 11 inchpoint mul def /boxspace 0.2 inchpoint mul def /borderwidth 0.3 inchpoint mul def % size adjustments to make it pretty /yalign 0.00 def % adjust labels down by fraction of height /xalign 0.04 def % adjust labels right by fraction of width /fontxscale 0.94 def % font size as fraction of max label width /fontyscale 0.90 def % font size as fraction of height / lines /linespace 1.20 def % max line spacing as fraction of font size /thinline 0.33 def % thin line as a fraction of regular line %%%%%%%%%%%%%%%%%%%%%%%%%% program begins here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 200 200 translate .25 .25 scale % debug lost boxes /pagematrix matrix currentmatrix def /unitstring 2 string def /showunit { % displays up to non-string type on stack 0 0 moveto /unit unit 1 add def dup type /stringtype eq { unit dup 9 le {numwidth 0 rmoveto} if unitstring cvs showproc unitlines 3 ge {0 lineyinc neg moveto} {numwidth 0 rmoveto} ifelse 1 index type /stringtype eq { currentpoint 4 -1 roll showproc lineyinc sub moveto } if showproc } if nextunit translate } def /dolabelproc { gsave width xalign mul height yalign mul lineyinc sub translate /unit 0 def /numwidth (0) stringwidth pop def 0 labelproc pop grestore } def /widthproc { % used below to determine fontscale stringwidth pop 0 rmoveto currentpoint pop dup maxwidth gt {/maxwidth exch def} {pop} ifelse } def % - boxpos initx inity /posBottomLeft { 0 1 } def /posBottomRight {-1 1 } def /posTopRight {-1 0 } def /posTopLeft { 0 0 } def % - boxdir stepx stepy /dirUp { 0 1 } def /dirRight { 1 0 } def /dirDown { 0 -1 } def /dirLeft {-1 0 } def /dirNone { 0 0 } def /dolabels { % do labels starting at current 0 0 % define: boxpos, boxdir for location & direction % boxsize, boxproc, nextunit for each type % call: copies width height unitlines dolabels /unitlines exch def /height exch def /width exch def /Helvetica-Bold findfont dup % determine fontscale to fit text in box fontyscale height mul unitlines div dup /fontscale exch def scalefont setfont /lineyinc 0 def /maxwidth 0 def /showproc dup {widthproc} def dolabelproc {show} def /maxunit unit def fontxscale width mul 1 xalign add maxwidth mul div fontscale mul fontyscale height mul unitlines div 1 yalign add div fontscale mul 2 copy gt {exch} if pop dup /fontscale exch def scalefont setfont /lineyinc % determine lineyinc that looks OK height fontyscale mul unitlines div fontscale linespace mul 2 copy gt {exch} if pop def % set initial position of this box and save this position boxpos boxsize exch 4 -1 roll mul 3 1 roll mul 2 copy translate 3 -1 roll { % produce n copies of labels boxproc dolabelproc % step position to next box boxdir boxsize exch 4 -1 roll exch boxspace add mul 3 1 roll boxspace add mul translate } repeat exch neg exch neg translate % restore initial position } def /dobox { newpath 0 0 moveto dup neg 0 exch rlineto exch 0 rlineto 0 exch rlineto closepath stroke } def /dovlines { newpath 0 0 moveto {dup neg 2 index exch rmoveto dup 0 exch rlineto} repeat pop pop stroke } def /dohlines { newpath 0 0 moveto {dup 2 index neg rmoveto dup neg 0 rlineto} repeat pop pop stroke } def /dothinhlines { currentlinewidth dup thinline mul setlinewidth 4 1 roll dohlines setlinewidth } def %%%%%%%%%%%%%%%%%%%%%%% label procedures begin here %%%%%%%%%%%%%%%%%%%%%%%%%% % % bottom right, going up: % maxi controller % home computer interface (CP290) % old maxi controller % pagematrix setmatrix pagewidth borderwidth sub borderwidth translate /boxpos {posBottomRight} def /boxdir {dirUp} def % maxi controller labels /boxsize {maxiboxwidth height 2 mul} def /boxproc { maxiboxwidth height 2 mul dobox maxiboxwidth width 4 mul sub 2 { width 4 mul height 2 mul dobox height width 4 mul 1 dohlines width height 2 mul 3 dovlines dup 0 translate } repeat 2 mul neg 0 translate } def /nextunit {width unit 4 mod 0 eq {unit 8 eq {-7 mul maxiboxwidth add height} {-3 mul height neg} ifelse} {0} ifelse} def maxicopies maxiwidth maxiheight 3 dolabels % home computer interface (CP290) labels /boxsize {hciwidth 4 mul height 2 mul} def /boxproc { width 4 mul height 2 mul dobox height width 4 mul 1 dohlines width height 2 mul 3 dovlines } def % units 9-16 are off the page, since the hci only has 1-8 buttons /nextunit {width unit 4 mod 0 eq {unit 8 eq {2 mul} {-3 mul} ifelse height neg} {0} ifelse} def hcicopies hciwidth hciheight 2 dolabels % old maxi controller (ultrasonic base) labels /boxsize {width 4 mul height 4 mul} def /boxproc { width 4 mul height 4 mul dobox height width 4 mul 3 dohlines width height 4 mul 3 dovlines } def /nextunit {width unit 4 mod 0 eq {-3 mul height neg} {0} ifelse} def oldmaxicopies oldmaxiwidth oldmaxiheight 3 dolabels % % bottom left, going up: % mini controller % pagematrix setmatrix borderwidth borderwidth translate /boxpos {posBottomLeft} def /boxdir {dirUp} def % mini controller labels - depends on another label box setting "maxunit" /boxsize {width 4 mul miniboxheight} def /boxproc { width 4 mul miniboxheight dobox width miniboxheight 3 dovlines height width 4 mul 5 unitlines sub dothinhlines } def /nextunit {width unit 4 mod 0 eq {-3 mul height neg} {0} ifelse} def minicopies miniwidth miniboxheight maxunit 3 add 4 idiv div 2 maxunit 8 le {1 add} if dolabels % % top left, going right: % radio controller % palm pad % pagematrix setmatrix borderwidth pageheight borderwidth sub translate % upper left /boxpos {posTopLeft} def /boxdir {dirRight} def % radio controller labels /boxsize {width rcboxheight} def /boxproc { width rcboxheight dobox height 2 mul width 8 dohlines height width 15 dothinhlines } def /nextunit {0 height unit 8 eq {13 mul} {-2 mul} ifelse} def rccopies rcwidth rcheight 2 dolabels % Palm Pad controller labels /boxsize {width ppboxheight ppboxyoffset add width 2 div add} def /boxproc { 0 ppboxyoffset moveto width 2 div dup ppboxheight neg exch 180 0 arc width ppboxyoffset lineto closepath 0 0 moveto width 0 rlineto stroke height 2 mul width 8 dohlines height width 15 dothinhlines } def 0 ppboxyoffset neg 2 copy translate ppcopies rcwidth rcheight 2 dolabels neg exch neg exch translate showpage % full page wall chart pagematrix setmatrix -90 rotate borderwidth borderwidth translate /boxpos {posBottomLeft} def /boxdir {showpage dirNone} def /boxproc { width 4 mul height 4 mul dobox height width 4 mul 3 dohlines width height 4 mul 3 dovlines } def /nextunit {width unit 4 mod 0 eq {-3 mul height neg} {0} ifelse} def /boxsize {width 4 mul height 4 mul} def pagecopies pageheight borderwidth 2 mul sub 4 div pagewidth borderwidth 2 mul sub 4 div 3 dolabels %%%%%%%%%%%%%%%%%%%%%%% end of x10-labels.ps %%%%%%%%%%%%%%%%%%%%%%% --------------91C7D88FF22B67BB32CD2DED Content-Type: application/postscript; name="EndOfJob.ps" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="EndOfJob.ps"  --------------91C7D88FF22B67BB32CD2DED--