/********************************************************************** This script is provided as part of the Daz Script Documentation. The contents of this script, and\or any portion thereof, may only be used in accordance with the following license: Creative Commons Attribution 3.0 Unported (CC BY 3.0) - http://creativecommons.org/licenses/by/3.0 To contact Daz 3D or for more information about Daz Script visit the Daz 3D website: - http://www.daz3d.com **********************************************************************/ // Source: /public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/remote_operation/sub_script/start // Define an anonymous function; // serves as our main loop, // limits the scope of variables (function( aArgs ){ /*********************************************************************/ // String : A function for retrieving a translation if one exists function text( sText ) { // If the version of the application supports qsTr() if( typeof( qsTr ) != "undefined" ){ // Return the translated (if any) text return qsTr( sText ); } // Return the original text return sText; }; /*********************************************************************/ // Declare working variables var vArg; var sType; // Initialize var aLines = new Array( aArgs.length ); // Iterate over the arguments passed to the script for( var i = 0, nArgs = aArgs.length; i < nArgs; i += 1 ){ // Get the 'current' argument vArg = aArgs[ i ]; // Get the 'current' type sType = typeof( vArg ); // Stringify based on the type of the argument switch( sType ){ case "object": aLines[ i ] = String("%1 : %2") .arg( sType ) .arg( JSON.stringify( vArg ) ); break; default: aLines[ i ] = String("%1 : %2") .arg( sType ) .arg( vArg ); break; } } // Define text variables for the message var sButton = text( "&OK" ); var sTitle = text( "Arguments" ); var sMessage = aLines.join( "\n" ); // Display the message MessageBox.information( sMessage, sTitle, sButton ); // Finalize the function and invoke })( getArguments() );