Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to integrate TCL into Labveiw 8.2

43 views
Skip to first unread message

mike.h...@gmail.com

unread,
Aug 1, 2007, 5:56:06 PM8/1/07
to
Hi There,
I would like to integrate TCL in Labview so that I can run any single
Tcl command in Labview, I have read some posts both in Labview and
this forum, I found there are two ways to do that, the first is to use
System exec.VI, by this way, I can use Labview to exect a Tcl file
(*.tcl) by incoporating "wish.exe", for example,
"wish TCL_changestring string"

However, I can not run a single Tcl command like "wish puts {hello}"
which will not work. In order to run a single Tcl command, I need to
use "Open system command pipe.vi" but that seems to be a Mac and linux
version, no windows version available. so anyone have a suggestion on
how to solve this problem? Thank you,

Mike

Neil Madden

unread,
Aug 2, 2007, 11:14:34 AM8/2/07
to

You can use a small script that accepts commands as arguments and
executes them:

# do.tcl
eval $argv

Put that in a file called "do.tcl" and then exec it from labview like as
"tclsh do.tcl puts Hello".

-- Neil

mike.h...@gmail.com

unread,
Aug 2, 2007, 7:12:02 PM8/2/07
to
Hi Neil,
That's really a good idea, I have tried that in labview and it works,
now I can input a single command like "puts hello",however, when I
need to load a dll (dynamic link library) file and run a command from
the DLL file, I still dont know how to do that in labview, the way to
do that in command prompt is:
tclsh load myfile.dll
%i2c_rd Ox23 3
Ox33

do you have any idea on how to realize it in labview? thanks,

Mike

On Aug 2, 8:14 am, Neil Madden <n...@cs.nott.ac.uk> wrote:

Bart

unread,
Aug 2, 2007, 7:46:09 PM8/2/07
to
mike.h...@gmail.com wrote:
> Hi Neil,
> That's really a good idea, I have tried that in labview and it works,
> now I can input a single command like "puts hello",however, when I
> need to load a dll (dynamic link library) file and run a command from
> the DLL file, I still dont know how to do that in labview, the way to
> do that in command prompt is:
> tclsh load myfile.dll
> %i2c_rd Ox23 3
> Ox33
>
> do you have any idea on how to realize it in labview? thanks,
>
> Mike


Perhaps you could expand on that idea: create a file containing
the exact commands you want to run. instead of giving commands
as arguments to the single line tclsh, you give it the name of the file
containing your scripts.


tclsh do.tcl c:/process_me.tcl

# process_me.tcl
load myfile.dll
puts "xyz"
etc.


# do.tcl
# note: add some checks on the args
eval [read [open [lindex $argv 0]]]


Neil Madden

unread,
Aug 3, 2007, 2:17:32 AM8/3/07
to
Bart wrote:
...

> Perhaps you could expand on that idea: create a file containing
> the exact commands you want to run. instead of giving commands
> as arguments to the single line tclsh, you give it the name of the file
> containing your scripts.
>
>
> tclsh do.tcl c:/process_me.tcl

>

> # do.tcl
> # note: add some checks on the args
> eval [read [open [lindex $argv 0]]]

Or just do tclsh c:/process_me.tcl ... (or use [source]).

-- Neil

Dennis LaBelle

unread,
Aug 3, 2007, 7:03:34 AM8/3/07
to
mike.h...@gmail.com wrote:

Try doing a system exec call that issues a command like 'echo puts hello |
tclsh'. I do this sometimes when I just want to issue a single command to
tclsh. If you need to do more than one command you can use a semicolon to
separate your TCL commands e.g., 'echo "puts hello; puts world" | tclsh'

Dennis LaBelle

mike.h...@gmail.com

unread,
Aug 3, 2007, 12:44:41 PM8/3/07
to
Hi Dennis,
I have tried this way,

echo puts hello | tclsh

in sysmtem exce.VI, but it won't work, labview output "memory is full,
NI488 detect no listner." I tried it command prompt, it works well.

so do you think whether I can use this way to run the following
command,

tclsh load myfile.dll
%i2c_rd Ox23 3


where myfill.dll is a Dynamic link library, and i2c_rd is a command
created in myfile.dll.

Mike


> tclsh'.
On Aug 3, 4:03 am, Dennis LaBelle <label...@nycap.rr.com> wrote:

> Dennis LaBelle- Hide quoted text -
>
> - Show quoted text -


0 new messages