Jump to content

Script callback on a button


Mzigaib

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
Link to comment
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.
 

Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...