Search - User list
Full Version: Autosave
Root » Houdini Lounge » Autosave
Hi guys,

Trying to get this python script I came across to work in H17.

# Ask about turning on Autosave
# but only if running interactive Houdini session!

set fullver = `run(“version -n”)`
set app = `arg($fullver,0)`

if(`strcmp($app,“hscript”)` < 0 && `strcmp($app,“rscript”)` < 0 && `strcmp($app,“hbatch”)` < 0)
set turnOn = `run(“message -b Yes,No -d 0 Turn on Autosave?”)`

if($turnOn == 0)
autosave on

Console is giving me a syntax error on startup.
Error running Python code:
SyntaxError: ('invalid syntax', ('DUsers/Chris Angelius/Documents/houdini17.0/scripts/', 4, 11, ‘set fullver = `run(\x93version -n\x94)`\n’))
It's been pointed out that the above snippet is actually hscript and not python but even changing the script to a .cmd file which should allow hscript to be run at launch doesn't actually work.

I'm now using
import hou
hou.appendSessionModuleSource('''hou.hscript("autosave on")''')

which defaults autosave to on but would prefer to have the option of enabling it via a popup dialogue at the start of each session.

If anyone has any idea how to code that it would be appreciated.
if hou.isUIAvailable():
import hdefereval
def _ask():
if hou.ui.displayMessage("Turn on autosave? ", buttons=("No", "Yes")) == 1:
hou.hscript("autosave on")
hou.hscript("autosave off")
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB