Currently in WB11, avi animations are created and saved one at a time. How can I create and save a batch of avi animations, one for each result in the Solution branch?
Please try the attached script (JScript). To run it, choose "Tools" > "Run Macro". It should run through each result item in the tree, and save all videos to the folder of your choice. You can edit the scriptfile to change the directory to be whatever you want (currently hardcoded to C:videos). Try to avoid opening other windows on top of WorkBench during execution, as the foreground window may be included in the final videos. /**************************************************/ /* saveAnimations.js */ /* - a script to save all result animations */ /* */ /* Aaron C Acton */ /* aaron.acton@ansys.com */ /* Technical Support Engineer, ANSYS Inc. */ /* 11/16/2007 */ /**************************************************/ // set the directory where you would like the videos to be stored var directory = "C:videos", filename; // set some global variables var oScript = WB.AppletList.Applet( "DSApplet" ).App.Script; var fileSystem = new ActiveXObject("Scripting.FileSystemObject"); var nodeList = oScript.tv.Nodes; var id_Result = 520; // if the directory exists if(fileSystem.FolderExists(directory)) { // loop thru each tree node for(var k = 1; k <= oScript.tv.Nodes.Count; k++) { // make sure it is expanded nodeList(k).Expanded = true; // if we land on a result item if(nodeList(k).Tag.Class == id_Result) { // select the current tree item oScript.tv.selectedItem = nodeList(k); // set the filename filename = directory + nodeList(k).Parent.Parent.Parent.Tag.Name + " - " + nodeList(k).Parent.Parent.Tag.Name + " - " + nodeList(k).Tag.Name + ".avi"; // store the video oScript.doSaveResultAVIFile( filename ); } } // if the directory does not exist } else { // alert the user WBScript.Out("Please create the directory " + directory, true); } |
||
|