Hi, I am a very beginner of coding and looking for a custom save shell by python. This time, especially I'd like to ask for how to replace ".comment." part.
Example file is "fx_dest_vocity_v051.04.comment.hip" and a procedure is :
1 - click shelf dock
2 - show a popUpWindow and type a comment
3 - click the popUpWindow, close it, and a script replaces "comment" part and new file name is saved, for example, "fx_dest_vocity_v051.04.vel2xfaster.hip"
my best guess is;
fileName = hou.hipFile.basename() ## for instance, file name is "fx_dest_vocity_v051.04.comment.hip"
hou.ui.displayMessage("type comments", variable ) ## save comment
hou.ui.displayMessage.close
result = re.search( "([0-9]{2})\.???????\.hip", fileName ) ## get comment part
newFileName = fileName.replace( result.group(1), variable )
hou.hipFile.save(newFileName) ## new file name "fx_dest_vocity_v051.04.vel2xfaster.hip"
I know it's so many broken lines, so if someone helps to rewrite it, it would be great, thanks!