Thank you
Marc
in wish, when I say
% package require printer
i get
0.7.0.1
which is expected
but when I do
%printer attr
I get
error while autoloading "printer": couldn't load file
"C:\PROGRA~1\TCL\lib\tcl8.0\printer\printer.dll": invalid argument
Any suggestions? I need an immediate answer for some software I am
writing to prove that tcl is just as useful as Visual Basic in the
Windows environment
Thank You
John Brockmeyer
j...@lobo.net
Hi John,
You find a Tcl bug in Win95 again.
Notice you install Tcl in the C:\Program Files\ directory.
The trouble is the space directory for the library "Program Files".
Reinstall your tcl in the directory without the space.
Best,
Chang
Here is a small example demonstrating the usage of the
'fileevent' command to transfer input coming from a
file/socket/pipe (script) into a text widget (*).
The 3 parts are:
1) fe-driver
A tcl script writing a file given on its commandline
to stdout. A delay is executed after each character
to make it slower, enabling the user to follow whole
process.
Buffering of stdout is switched off to enable the
transfer of single characters. line buffering would
occur else.
2) fe
The main script. It reads from a pipe created with
'open' and displays the read data in the text widget.
fileevent is used to handle input as it comes in, without
blocking the application.
3) fe-exam.sh
A simple shell script calling the above with proper
arguments.
The example assumes that tclsh, wish reside in /usr/local/bin.
-------------------------------------------------------------------------------
#!/usr/local/bin/tclsh
# generate characters and send them to stdout.
# use after to make it slower for demonstration purposes
set time [lindex $argv 1]
set data [exec cat [lindex $argv 0]]
set data [split $data {}]
fconfigure stdout -buffering none
foreach x $data {
puts -nonewline $x
after $time
}
-------------------------------------------------------------------------------
#!/usr/local/bin/wish
# fileevent example
# (reading the output of an external command into a text widget)
# no luxuries (like scrollbars)
set command [lindex $argv 0]
set f [open "|$command" r]
fconfigure $f -blocking 0
fileevent $f readable [list handleInput $f]
text .t -bd 3 -relief sunken -bg yellow -fg red -width 80 -height 30
pack .t -side top -fill both -expand 1
proc handleInput {f} {
# - delete handler if input was exhausted.
if {[eof $f]} {
fileevent $f readable {}
close $f
return
}
set data [read $f]
if {[string length $data] > 0} {
.t insert end $data
}
}
-------------------------------------------------------------------------------
#!/bin/sh
fe 'fe-driver fe 1'
-------------------------------------------------------------------------------
(*) This example uses a pipe. I have another for sockets. Just mail
and ask for it.
--
Sincerely,
Andreas Kupries <a.ku...@westend.com>
<http://www.westend.com/~kupries/>
-------------------------------------------------------------------------------
> I am having problems loading and running the printer extension stuff in
> WIN-98.
> the main tcl library is at
> c:\Program Files\tcl\lib,
> and the printer files (both printer.dll and pkgindex.tcl) are in the
> c:\Program Files\tcl\lib\tcl8.0\printer directory.
>
> in wish, when I say
> % package require printer
> i get
> 0.7.0.1
> which is expected
>
> but when I do
>
> %printer attr
>
> I get
>
> error while autoloading "printer": couldn't load file
> "C:\PROGRA~1\TCL\lib\tcl8.0\printer\printer.dll": invalid argument
>
>
Please excuse me. I paniced too early.
It needed cw3220.dll, which you can get off the net.
Now things sort of work.
And so if you don't like the way your specific application works,
pat yourself on your shoulder and let you know you don't like what you coded.
:the C-program has to be a 'stand-alone'-program, that means it should
Well, no, it doesn't _have_ to be a stand alone program. You could
use one of the other variations - like using SWIG or jWrap to
turn your modules into Tcl commands.
:also run without Tcl/Tk. I guess I have
:to create pipes between the C-program and the Tcl-script and send the
No, you could change the C program to use sockets, shared memory,
the Tk send command, etc. Lots of IPC mechanisms.
In fact, I think there is a member of this usenet group who is
working on a high level document touching on some of the
alternatives. Alex, are you back from holiday yet?
:data to the script. Has anybody experience
:with that approach ? Perhaps an example-programm and script would help
:me .....
Lots of folk - in fact, some nice examples appear in the expect
distribution - see <URL:http://www.teraform.com/%7Elvirden/tcl-faq/>
for pointers to Expect.
--
<URL:mailto:lvi...@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
Thanks Larry for this introduction !
In a few days, there'll be an URL ;-)
So Marc, if you can way that long, stay tuned !
-Alex