doc Posted January 26, 2006 Share Posted January 26, 2006 Here's my dilemma, I want to start hscript from the textport of an open houdini session. after opening hscript I want to execute the openport command something like: unix "hscript myfile.hip" unix "openport 77000" The only problem with this is the unix command will spawn two separate processes. I tried the following: unix "hscript myfile.hip; openport 77000" but his doesn't work either, rather than executing openport in hscript it's trying to execute it in the shell. I also tried: unix "hscript myfile.hip\; openport 77000" and unix "hscript myfile.hip < openport 77000" without success, anybody have any ideas? many thanks Luca Quote Link to comment Share on other sites More sharing options...
doc Posted January 26, 2006 Author Share Posted January 26, 2006 tried this as well: echo "openport 72000" | hscript & but it didn't work Quote Link to comment Share on other sites More sharing options...
edward Posted January 26, 2006 Share Posted January 26, 2006 You might have to create a tmp file with your commands first and then run "unix hscript myfile.hip myscript.cmd" Quote Link to comment Share on other sites More sharing options...
doc Posted January 26, 2006 Author Share Posted January 26, 2006 You might have to create a tmp file with your commands first and then run "unix hscript myfile.hip myscript.cmd" 24160[/snapback] Thanks Ed, that did the trick Quote Link to comment Share on other sites More sharing options...
rjpieke Posted January 27, 2006 Share Posted January 27, 2006 Here's my dilemma, I want to start hscript from the textport of an open houdini session.after opening hscript I want to execute the openport command 24158[/snapback] As an alternative to Edward's suggestion, you could wrap the hscript launching in a simple Python script that you call instead (ie 'unix "launchHscriptAndOpenPort myFile.hip 77000"') where launchHscriptAndOpenPort would look something like (I haven't tested this, so there may be typos): #!/bin/python import os import sys file = sys.argv[ 1 ] port = sys.argv[ 2 ] houdini = os.popen( "hscript "+file, "w" ) houdini.write( "openport "+port ) os.wait() houdini.close() I'm also not sure if this only works on Linux or not (I seem to remember os.wait() is not a Windows-happy function). Wow, ok, so maybe this isn't the most versatile suggestion after all Quote Link to comment Share on other sites More sharing options...
doc Posted January 27, 2006 Author Share Posted January 27, 2006 As an alternative to Edward's suggestion, you could wrap the hscript launching in a simple Python script that you call instead (ie 'unix "launchHscriptAndOpenPort myFile.hip 77000"') where launchHscriptAndOpenPort would look something like (I haven't tested this, so there may be typos): 24186[/snapback] thanks Rob, I actually ended up using popen2 to open hscript with the optional .cmd as Ed suggested. And then I used openport to send commands to the hscript session. Your method looks better though. I should just be able to send commands straight to hscript and bypass the whole openport buisness completely. Thanks! Luca Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.