Below is an example demonstrating the creation of another script that will clear any currently mapped content directories and subsequently set the mapped content directories to those that were mapped at the time the script was created.
// Define an anonymous function; // serves as our main loop, // limits the scope of variables (function(){ // Create a script object var oScript = new DzScript(); // Create a file filter object var oFileFilter = new DzFileFilter(); // Add the script extentions to the filter oScript.addScriptTextExtensionsAsMultipleFilters( oFileFilter ); oScript.addScriptBinaryExtensionsAsMultipleFilters( oFileFilter ); // Declare some common variables var nExtensions = 0; var aExtensions = []; // Pre-size an array we'll use to construct a filter string var aFilters = new Array( n ); // Iterate over the filters for( var i = 0, n = oFileFilter.getNumFilters(); i < n; i += 1 ){ // Get the number of extensions for the 'current' filter nExtensions = oFileFilter.getNumExtensions( i ); // Pre-size an array we'll use to construct the // extension portion of the filter string aExtensions = new Array( nExtensions ); // Iterate over the extensions for( var j = 0; j < nExtensions; j += 1 ){ // Collect the extension aExtensions[ j ] = oFileFilter.getExtension( i, j ); } // Construct the 'current' filter string aFilters[ i ] = String("%1 (*.%2)") .arg( oFileFilter.getFilterDescription( i ) ) .arg( aExtensions.join(" *.") ); } // Prompt the user for the path/name of the script to save var sFile = FileDialog.doFileDialog( false, qsTr("Save As"), "", aFilters.join(";") ); // If the user cancelled if( sFile.isEmpty() ){ // We are done... return; } // Let the user know we are busy setBusyCursor(); // Get the content manager var oContentMgr = App.getContentMgr(); // Add a line to our script that gets the content manager oScript.addLine( "var oContentMgr = App.getContentMgr();" ); // Add a line to our script to remove mapped native directories oScript.addLine( "" ); oScript.addLine( "oContentMgr.removeAllContentDirectories();" ); //If the application version is 4.9.0.34 or newer if( App.version64 >= 0x0004000900000022 ){ // Add the line for the Daz Connect Data directory oScript.addLine( "" ); oScript.addLine( "if( App.version64 >= 0x0004000900000022 ){ //4.9.0.34+" ); oScript.addLine( String( "\toContentMgr.setCloudContentDirectory(\"%1\");" ) .arg( oContentMgr.getCloudContentDirectoryPath() ) ); oScript.addLine( "}" ); oScript.addLine( "" ); } // Get the number of mapped native directories and iterate // over the paths, adding a line for each to our script for( var i = 0, n = oContentMgr.getNumContentDirectories(); i < n; i += 1 ){ oScript.addLine( String( "oContentMgr.addContentDirectory(\"%1\");" ) .arg( oContentMgr.getContentDirectoryPath( i ) ) ); } // Add a line to our script to remove mapped Poser directories oScript.addLine( "" ); oScript.addLine( "oContentMgr.removeAllPoserDirectories();" ); // Get the number of mapped Poser directories and iterate // over the paths, adding a line for each to our script for( var i = 0, n = oContentMgr.getNumPoserDirectories(); i < n; i += 1 ){ oScript.addLine( String( "oContentMgr.addPoserDirectory(\"%1\");" ) .arg( oContentMgr.getPoserDirectoryPath( i ) ) ); } // Add a line to our script to remove mapped import directories oScript.addLine( "" ); oScript.addLine( "oContentMgr.removeAllImportDirectories();" ); // Get the number of mapped import directories and iterate // over the paths, adding a line for each to our script for( var i = 0, n = oContentMgr.getNumImportDirectories(); i < n; i += 1 ){ oScript.addLine( String( "oContentMgr.addImportDirectory(\"%1\");" ) .arg( oContentMgr.getImportDirectoryPath( i ) ) ); } // Cause the UI to refresh oScript.addLine( "" ); oScript.addLine( "oContentMgr.refresh();" ); // Save the script to file oScript.saveToFile( sFile ); // Let the user know we are done clearBusyCursor(); // Finalize the function and invoke })();