ldmxnotify program: added print capability

Hi,

A couple of months ago I sent a note with the tcl/tk script that will
pop-up an X window with a
bulletin from the LDM. This is nice, so you don't have to print every
statement, warning etc.

Today I added the ability to print the bulletin, via a print button. So I
thought I would pass it along.

In order to run this you must have tcl/tk installed, many systems do. I am
running
this on Linux.

In order to print you must have your printer defined, ie  lp0 in my case.

An example pqact.conf entry that will pop-up any Tropical Bulletins from
the NHC:

DDPLUS  ^WTNT.. KNHC
        PIPE    -strip -close /weather/ldm/bin/ldmxnotify -d wxdata3:0 lp0


The '-d wxdata3:0' is the X display definition
The 'lp0'  is the print spool.


If you have any questions let me know,

Mike Dross

Below is the script:

ldmxnotify
-------------->
#!/usr/bin/wish

# gets printer spool name from command line variable argv

# take the stdin text and assign to variable $info
set info [exec cat]

text .xstdin -yscrollcommand {.s set}
.xstdin insert 1.0 $info

scrollbar .s -orient vertical -command {.xstdin yview}
button .b1 -text Exit -command exit
button .b2 -text "Print" -command Prnt

# .b1 gets the entire bottom of the window.
pack .b1 -side bottom
pack .b2 -side bottom

# Pack .s next, so that if the user decreases the size
# of the window, the Text widget shrinks instead of
# the Scrollbar. .s gets the right-hand side of the space
# left over. It fills it vertically.
pack .s -side right -fill y

# Pack .xstdin last. Expand its packing space into
# any additional space that becomes available if the
# user resizes the window. Have the Text widget
# completely fill its packing space.
pack .xstdin -expand yes -fill both

# Beep on pop-up
bell

# Sleep 5 minutes (300,000 milliseconds) then close window
after 300000 exit


proc Prnt {} {
# Make info a global variable otherwise would not get read in a prodcedure
global info  argv

# Spool to printer
exec lpr -P$argv <<$info
}


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the ldm-users archives: