Jump to content
Mzigaib

Script callback on a button

Recommended Posts

I am not succeeding in make this script work on a button with a callback script:

if ( `run("message -b Delete,Cancel -d 0 Are you sure?")`==0),`run('message deleted')` ,`message('message canceled')` )

What am I doing wrong? Any tips?

Edited by Mzigaib
Misspell

Share this post


Link to post
Share on other sites

Do you need to make it hscript? If not, the python equivalent would be something like

 

On PythonModule define a function:
 

def displayMessage(kwargs):
    hou.ui.displayMessage("Are you sure?", ("Delete", "Cancel"))

 

And then on the Callback Script field you can write `hou.phm().displayMessage(kwargs)` and that's it.
 

Share this post


Link to post
Share on other sites

I am used to do everything in hscript but in this case I couldn't make it work also because I am trying to do the code it in just on line where where the callback script is limited to and I didn't want to write a function so I would prefer to do it in hscript though I know that using python would be welcome.

Share this post


Link to post
Share on other sites

the callback itself works fine for me. only thing is it always returns "deleted" even if i hit cancel. I usually do stuff like that with python so I can't help you with that, sorry

Edited by 3dome

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×