Parameters Object

The parameters object is used to pass parameters to SWF Studio commands.

In the definition of every ssCore command there is a list of input parameters that command accepts. Some are optional, some are required. When you call an ssCore command you pass these parameters as named properties of the parameters object.

For example, the ssCore.App.showMsgBox function defines five input parameters:

·  icon [Optional]
·  buttons [Optional]
·  defaultButton [Optional]
·  prompt
·  title [Optional]

Only the prompt parameter is required so we must supply the prompt parameter, but we can also pass as many optional parameters as we want. Here's an example call that passes three parameters: prompt, icon and buttons (see the definition of ssCore.App.showMsgBox for details about these parameters) to ssCore.App.showMsgBox as named properties of the parameters object.

ssCore.App.showMsgBox({prompt:"Are you ready?", icon:"question", buttons:"YESNO"});

You can use one of two methods for specifying the parameters object. You can create the object inline (as we've shown above) or you can create a variable to hold the object. Either method is acceptable, but you will find most examples will use the inline method. This is because the inline method requires you to write fewer lines of code and, since the properties are inline with the command, it makes the code easier to read.

Any properties you set on the parameters object will also be available on the return object. This means you can also supply properties that don't exist for that command and they will simply be created and passed as part of the return object.

Notes:

All data passed as properties on the parameters object will be converted into string format. A property like {flag:true} will be treated the same as {flag:"true"} but you should be on the lookout for unintended type conversions.