Is there any possible to make otl UI to run dos command?
For example:
xxx(excutable command) -parameterA valueA -parameterB valueB
I want to make this command into otl interface, so I can run xxx.exe in houdini with the otl, and twick the parameters and values easier.
^_^
is there any possible to make dos command to otl interface?
2891 2 1- ykcosmo
- Member
- 288 posts
- Joined: July 2005
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
You mean you want to run external application via command line from otl?
You can do this like this:
(minimal)
Make a button, and write hscript command in its callback script field:
unix xxx.exe your_parameters
or
(hscript)
Add a new script section in Script Tab. Gather all information needed like:
set node = $arg1
set my_parameter = `chs(node/my_parameter)`
# and call xxx.exe
unix xxx.exe my_paremater
Call the script with a button in UI by callback command:
opdef:?my_script
(Python)
Finally this is a time to use Python in which case you don't have to use external application for playing with simple stuff like preparing parameters.
Many tasks can by handled with python and external modules very easily. In fact it's hard to imagine task that can't be done in python nowadays .
Write here what do you want to do and maybe someone will point you to the solution.
Anyway, calling external app. in python:
Add a new script as before with a name “PythonModule” and then:
import subprocess
def main(self):
self = hou.node(self)
command = self.parm('some_parameter')
# better:
proc = subprocess.Popen(command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE )
(output, error) = proc.communicate()
# or simpler but you won't get returned values:
subprocess.call(command)
Call the script with callback field in your HDA UI with reference to the node:
hou.node('.').hdaModule().main(hou.node('.'))
You can do this like this:
(minimal)
Make a button, and write hscript command in its callback script field:
unix xxx.exe your_parameters
or
(hscript)
Add a new script section in Script Tab. Gather all information needed like:
set node = $arg1
set my_parameter = `chs(node/my_parameter)`
# and call xxx.exe
unix xxx.exe my_paremater
Call the script with a button in UI by callback command:
opdef:?my_script
(Python)
Finally this is a time to use Python in which case you don't have to use external application for playing with simple stuff like preparing parameters.
Many tasks can by handled with python and external modules very easily. In fact it's hard to imagine task that can't be done in python nowadays .
Write here what do you want to do and maybe someone will point you to the solution.
Anyway, calling external app. in python:
Add a new script as before with a name “PythonModule” and then:
import subprocess
def main(self):
self = hou.node(self)
command = self.parm('some_parameter')
# better:
proc = subprocess.Popen(command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE )
(output, error) = proc.communicate()
# or simpler but you won't get returned values:
subprocess.call(command)
Call the script with callback field in your HDA UI with reference to the node:
hou.node('.').hdaModule().main(hou.node('.'))
- ykcosmo
- Member
- 288 posts
- Joined: July 2005
- Offline
-
- Quick Links