button .textframe.viewit -text "view" \
-command {
.textframe.maintextbox mark set beginmark 1.0;
set newchannel2 [open /home/daveleo/scratchview.html w+];
set stufftowrite [.textframe.maintextbox get 1.0 {end -1c} ];
puts $newchannel2 [.textframe.maintextbox get beginmark end];
close $newchannel2;
exec epiphany $newchannel2 &
}
but here is what happens:
the epiphany browser opens to my homepage (google on the ineternet),
the term 'file6' is entered in the google search box (!!) and
apparently epiphany is looking for 'file6'.
so the file name i am trying to pass to epiphany is not getting there.
any ideas would be appreciated
i am not a programmer .... i write tcl-scripts for my own use, so if
possible, please go easy on the explanation.
regards.... and thanks for your time.
I recommend never including so much code in a -command. For more details
see http://www.tclscripting.com/articles/apr06/article3.html. It has
nothing to do with your problem but it's good advice nonetheless.
> but here is what happens:
> the epiphany browser opens to my homepage (google on the ineternet),
> the term 'file6' is entered in the google search box (!!) and
> apparently epiphany is looking for 'file6'.
> so the file name i am trying to pass to epiphany is not getting there.
>
> any ideas would be appreciated
Perhaps what you want is:
...
exec epiphany /home/daveleo/scratchview.html
$newchannel2 is an internal identifier that refers to an open channel;
it simply can't be used by any other process. It appears your intent is
for ephiphany to open the file you are creating, so give it the file name.
I recommend doing it like this:
button .textframe.viewit -text "view" \
-command [list viewit .textframe.maintextbox]
proc viewIt {text} {
set data [$text get 1.0 end-1c]
set tmpfile "/home/daveleo/scratchview.html"
set f [open $file w]
puts $f $data
close $f
exec epiphany $tmpfile
}
Thanks .... your correction worked fine.... i will read up on
procedures.
You are passing the (closed) Tcl *channel* to the file. You should be
passing the URL to the file instead. Your last line should be:
exec epiphany file://localhost/home/daveleo/scratchview.html &
>
> regards.... and thanks for your time.
>
>
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
hel...@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk