v5.0
Exposes VBScript's InputBox to other scripting languages. This is a very useful little function for getting information
from a user. It displays a modal dialog box with a question and an edit box for the user to enter some data.
Note: When running in batch mode XSIInputBox will just return the value of the Default argument.
Tip: To collect more sophisticated information from the user, for example file paths, colors, or options out of a list, it
is better the create a CustomProperty or use the services of the XSIUIToolkit or
XSIDialog objects.
oString = XSIInputBox( [Prompt], [Title], [Default] ); |
The String entered by the user, or an empty string if the user cancelled or chose not to enter anything.
Parameter | Type | Description |
---|---|---|
Prompt | String | Text that tells the user what they should type in |
Title | String | Text to show in the title bar of the dialog box |
Default | String | A suggested response for the user, which is automatically returned if running in batch mode. |
/* Example showing how to ask the user for a unique name for a grid object. A loop is used to give the user another chance if they pick the name of an existing object */ while(true) { var strObjName = XSIInputBox( "Please pick a name for the new object", "Time for a Decision", "Foo" ) ; if ( strObjName != "" ) { var oExisting = Dictionary.GetObject( strObjName, false ) ; if ( oExisting == null ) { ActiveSceneRoot.AddGeometry( "Grid","MeshSurface", strObjName ) ; break ; } else { XSIUIToolkit.MsgBox( "That object already exists\n"+ "You have to think of a new name" ) ; } } else { // User cancelled break ; } } |
' ' Example showing how to ask the user for a unique name for a grid object. A loop is used ' to give the user another chance if they pick the name of an existing object ' do while true strObjName = XSIInputBox( _ "Please pick a name for the new object", _ "Time for a Decision", _ "Foo" ) if strObjName <> "" then set oExisting = Dictionary.GetObject( strObjName, false ) if typename( oExisting ) = "Nothing" then ActiveSceneRoot.AddGeometry "Grid","MeshSurface", strObjName exit do else XSIUIToolkit.MsgBox( "That object already exists" & vbCrLf & _ "You have to think of a new name" ) end if else ' User cancelled exit do end if loop |