From: APN on 13 Dec 2008 11:21 On Dec 13, 6:06 pm, Richard Owlett <rowl...(a)atlascomm.net> wrote: > set data "plot 'C:\dataset1.dat' using 1:3 \n" > In the above line, you might want to double the \ or use / instead depending on what gnuplot accepts. A single \ will be treated by Tcl as an escape sequence and not a directory separator. However, that error should not cause the text to appear in wish itself, so a couple of other things to try. First make sure you are getting the right window. The find_windows could be returning multiple windows even with the -text option - one corresponding to the toplevel and one corresponding to the child. Just to be sure, use find_windows -text $title -toplevel true and verify you get back a single window. Also, it might help if in addition to set_focus, you also call set_foreground_window. I'm not sure if this is strictly necessary and I can't tell from the MSDN documentation. /Ashok
From: Richard Owlett on 13 Dec 2008 11:48 Alexandre Ferrieux wrote: > On 13 d�c, 15:54, Richard Owlett <rowl...(a)atlascomm.net> wrote: > >>Alexandre Ferrieux wrote: >> >>>On 13 d�c, 14:06, Richard Owlett <rowl...(a)atlascomm.net> wrote: >> >>>>My OS is WinXP Pro Service Pack 2 >>>>I have Tcl versions 8.4.14.0 and 8.5.2.0 from ActiveState installed. >>>> Goal is to run Gnuplot commands from Tcl (eventually with the >>>> Tcl interpreter packaged with Scilab 4.1.2 [reports "TCL/TK 8.4.15 >>>> Final Release"]). >>>>I frequently use "TclTutor 3.0 Beta 2" as test bed for scripts because >>>>its error highliting scheme is helpful. >> >>>>My script (based on sample in TWAPI documentation) is: >> >>>># Send a text string to existing gnuplot window >>>>package require twapi >> >>>>set title gnuplot >>>>set data "plot 'C:\dataset1.dat' using 1:3 \n" >> >>>># Get all windows with that title >>>>set windows [twapi::find_windows -text $title] >>>>if {[llength $windows]} { >>>> set win [lindex $windows 0] >>>> # Set the focus to the window >>>> twapi::set_focus $win >>>> # Feed data in to the input queue >>>> twapi::send_input_text $data} else { >> >>>> puts "No windows found with title '$title'" >> >>>>} >> >>>>This script runs fine when run from TclTutor. Tested with and without >>>>the gnuplot window existing. >> >>>>It fails when run from Wish85, Tclsh85, Wish84, or Tclsh84. >>>>All 4 react the same. >>>>If no gnuplot window exists, that is correctly reported. >>>>If the gnuplot window does exist, the contents of $data appear in the >>>>Wish/Tclsh window. >> >>>>*This morning* it runs correctly under Scilab IF the gnuplot window >>>>exists. It [as might be expected] fails silently if the gnuplot window >>>>does not exist. I don't recall it working from Scilab at all *last night* ;/ >> >>>>I'm a Tcl newbie. What perfectly obvious thing am I missing? >>>>TIA >> >>>Hmm, looks you were a bit quick to abandon pipes ;-) >> >>*ROFL* !!! >>Hey, if a half century younger, I would have been diagnosed as ADHD. >>Besides, TWAPI will likely be very useful in another project. >>And one learns patience having run CUPL on CORC with 026 input device. >> >> >> >> >>>FWIW, after an admittedly longer-than-expected Google session, >> >>You mean I'm not the only one to discover that >>[google == " fascinating rabbit trails"] >> >>Could you list the URL's you found useful? TIA > > > I found > > http://www.nabble.com/names-of-gnuplot-Win32-binaries-td20437476.html > > by typing "wgnuplot_pipes" in Google Groups search and then sorting by > date. > > >>>The following works out of the box in an interactive tclsh/wish: >> >>I'll try it. >>But, you didn't answer the question of this thread ;) > > > Yes, because I think that switching to a nonportable method to make > two open-source, OS-agnostic tools talk together should buy you a room > number in Alcatraz ;-) > > -Alex > For better or worse, I'm in a Windows(tm) world and TWAPI seems to be organized in a way I'm familiar with.
From: Alexandre Ferrieux on 13 Dec 2008 11:55 On 13 déc, 17:48, Richard Owlett <rowl...(a)atlascomm.net> wrote: > > For better or worse, I'm in a Windows(tm) world and TWAPI seems to be > organized in a way I'm familiar with. Yeah. When the Earth was flat, the sky above was organized in a way most people were familiar with... -Alex
From: Richard Owlett on 13 Dec 2008 11:58 APN wrote: > On Dec 13, 6:06 pm, Richard Owlett <rowl...(a)atlascomm.net> wrote: > >>set data "plot 'C:\dataset1.dat' using 1:3 \n" >> > > > In the above line, you might want to double the \ or use / instead > depending on what gnuplot accepts. A single \ will be treated by Tcl > as an escape sequence and not a directory separator. However, that > error should not cause the text to appear in wish itself, so a couple > of other things to try. > > First make sure you are getting the right window. The find_windows > could be returning multiple windows even with the -text option - one > corresponding to the toplevel and one corresponding to the child. Just > to be sure, use > find_windows -text $title -toplevel true > and verify you get back a single window. That might be related to part of it. [twapi::find_windows -text $title] appears to be returning two handles. But I tried changing set win [lindex $windows 0] to set win [lindex $windows 1] to no avail. > > Also, it might help if in addition to set_focus, you also call > set_foreground_window. I'm not sure if this is strictly necessary and > I can't tell from the MSDN documentation. > That also looks promising. There seemed to occasionally be a discrepancy between apparent window with focus and window in foreground. But I didn't save enough of my trials to be able to reproduce what I was doing. > /Ashok
From: Richard Owlett on 13 Dec 2008 13:40 Richard Owlett wrote: > APN wrote: > >> On Dec 13, 6:06 pm, Richard Owlett <rowl...(a)atlascomm.net> wrote: >> >>> set data "plot 'C:\dataset1.dat' using 1:3 \n" >>> >> >> >> In the above line, you might want to double the \ or use / instead >> depending on what gnuplot accepts. A single \ will be treated by Tcl >> as an escape sequence and not a directory separator. However, that >> error should not cause the text to appear in wish itself, so a couple >> of other things to try. >> >> First make sure you are getting the right window. The find_windows >> could be returning multiple windows even with the -text option - one >> corresponding to the toplevel and one corresponding to the child. Just >> to be sure, use >> find_windows -text $title -toplevel true >> and verify you get back a single window. > > > That might be related to part of it. [twapi::find_windows -text $title] > appears to be returning two handles. But I tried changing > set win [lindex $windows 0] > to > set win [lindex $windows 1] > to no avail. > >> >> Also, it might help if in addition to set_focus, you also call >> set_foreground_window. I'm not sure if this is strictly necessary and >> I can't tell from the MSDN documentation. >> > > That also looks promising. There seemed to occasionally be a discrepancy > between apparent window with focus and window in foreground. > > But I didn't save enough of my trials to be able to reproduce what I was > doing. > >> /Ashok Both changes a required. *PLUS* another - restore_window Handles case of the gnuplot window having been minimized. Tested from Wish85 and Tclsh85. Now to see if I can make everything work together when called from Scilab. [Scilab issues, not Tcl] I can always be trusted to find a new way to crash a system ;) Thanks for your assistance.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: A problem of oratcl orabindexec cmd Next: eTcl on XBurst CPU |