Pause a script

Pause a script

brad.bylls
Collaborator Collaborator
652 Views
3 Replies
Message 1 of 4

Pause a script

brad.bylls
Collaborator
Collaborator

I have a script with a dialog box.

If the user presses continue and all of the criteria is not met, I put up a message box that says so.

When the user presses ok the dialog disappears.

How do I let the use complete the dialog and then continue?

Brad Bylls
0 Likes
Accepted solutions (1)
653 Views
3 Replies
Replies (3)
Message 2 of 4

MichaelT_123
Advisor
Advisor
# Uses optional arguments.
returnValue = userInterface_var.messageBox(text, title, buttons, icon)

MessageBoxButtonTypes Enumerator

YesNoCancelButtonType4The message box contains Yes, No, and Cancel buttons.

 

DialogResults Enumerator Description

Defines the valid return types from a dialog.
Defined in namespace "adsk::core" and the header file is <Core\CoreTypeDefs.h>

Methods

NameValueDescription
DialogCancel1The dialog box return value is Cancel (usually sent from a button labeled Cancel).
DialogError-1An unexpected error occurred.
DialogNo3The dialog box return value is No (usually sent from a button labeled No).
DialogOK0The dialog box return value is OK (usually sent from a button labeled OK).
DialogYes2The dialog box return value is Yes (usually sent from a buttons labeled Yes and Retry).
MichaelT
Message 3 of 4

BrianEkins
Mentor
Mentor
Accepted solution

The way Fusion commands are designed, the OK button should only be enabled when the current input meets the required criteria. That's the reason for the ValidateInputs event on the command. You can check if the current values meet your criteria and set the value of the areInputsValid property on the ValidateInputsEventsArg object appropriately. If this is False, the OK button will be disabled. 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 4 of 4

brad.bylls
Collaborator
Collaborator

Thanks Brian,

 

Must have been a senior moment to not think of that.

Works great now.

 

Brad

Brad Bylls
0 Likes