OTL File Callback Script for File extension

   3652   2   0
User Avatar
Member
556 posts
Joined: June 2006
Offline
I want to have a small script that checks if the insert file name has the extension in it if not it should add the correct file extension to it

as for test callback script i have made this one and it doesn't work:

// Hscrpt
if ( ${script_value:e} != “.jsx” ) then
set $script_parm = $script_value + “.jsx”

EDIT: it looks like strcmp should be used but when i insert it still won't work.

the first version i have made a python version in my script(otl /PythonModule) that works but it changes the $HIP to full path so i loss the $HIP what i don't want:

# Python
def getSelectedFile(ropNode):
node = ropNode.parm(“save_file”)
path = node.eval() # Eval doesnt come as $HIP
if path != “.jsx”:
path = path + “.jsx”
node.set(path)
return path

has someone a solution hscript or python?

thanks
User Avatar
Member
1786 posts
Joined: Nov. 2006
Online
You can use hou.Parm.unexpandedString() to get the raw, unevaluated path.
Graham Thompson, Pipeline Things
User Avatar
Member
556 posts
Joined: June 2006
Offline
thanks graham it works :-)
  • Quick Links