HScript <-> TCL

   4187   7   0
User Avatar
Member
12 posts
Joined: 7月 2005
Offline
Hello again,

I have an HScript script that takes in arguments, then is supposed to pass them into a TCL script. This doesn't work. Theonly way my TCL script takes args is if I open a TK window in Houdini then type “tclsh fileName.tcl args”.
The problem with this is that the lines of code that say “hscript ….” no longer work. So is there a way for me to pass my args that I type in textport throught to the .cmd file then the .tcl file?

Thank you
User Avatar
Member
7899 posts
Joined: 7月 2005
Offline
You don't mention *how* doesn't it work? If you're doing this from within a hscript, I think you need to call your tcl script with $arg1 $arg2 $arg3 etc …
User Avatar
Member
12 posts
Joined: 7月 2005
Offline
Oh, sorry about that.

If in the textport I do
>> source myfile.cmd $arg1 $arg2 $arg

and within myfile.cmd there is a line saying
>>tcl myfile.tcl $arg1 $arg2 $arg3
The arguments do not go through to the tcl. I get an error saying the syntax should be tcl myfile.tcl.

Now if I do
>>tclsh myfile.tcl $arg1 $arg2 $arg3.
The arguments go through BUT because in my tcl file, there are lines saying “hscript opadd …” or something, then I get a different error saying there is no such thing as hscript. This is because I'm now in TCL shell.


Thanks
User Avatar
Member
7899 posts
Joined: 7月 2005
Offline
This seems to work for me.

#test.cmd
tcl test.tcl $arg1 $arg2 $arg3


#test.tcl
tk_messageBox -message “$argv”
exit


# in textport
source test.cmd a b c


This is all assuming that you started houdini from the directory of where these files exist of course.
User Avatar
Member
12 posts
Joined: 7月 2005
Offline
You're right. I just tried it again and it worked. I think it might have been my test files.

But when I try the other way in the tk console:
>>source myfile.tcl $arg1 $arg2 $arg3, I still get the error.
User Avatar
Member
7899 posts
Joined: 7月 2005
Offline
I don't think source is a valid tcl command. I don't know what is the correct tcl way is to run another file.
User Avatar
Member
12 posts
Joined: 7月 2005
Offline
source is a valid comman but it takes no arguments.
http://www.tcl.tk/man/tcl8.0/TclCmd/source.htm [tcl.tk]

In the Tk console, if i type in:
myfile.tcl $arg1 $arg2 $arg3, I still get the error.

but if go into tclsh and type the above it works, as long as I'm not calling hscript or outside programs.

At least I'm getting parameters passed on through hscript so that works for me.

Thanks
User Avatar
Member
7899 posts
Joined: 7月 2005
Offline
Another version difference perhaps? I really have no idea.
  • Quick Links