Running a script (not from another script) with arguments
Is there a way to start a Daz Studio script (.dsa or .duf) with an initial argument or parameter? I'm trying to make better use of my StreamDeck, iCue hotkeys and Spacemouse and would like to be able to run a script that accepts a given value. I know I can call a script from outside Daz Studio, such as from a Command Line or StreamDeck macro and it will execute inside the current Daz Studio instance. The problem I have several scripts that would benefit from being able to pass them a value. For example, the script below, which I got from ShareCG, decreases the rotation on the X-axis for selected nodes by the nodes Increment Value. I can call it just by running the script as "RotateXDown.dsa" . I'd like to be able to run something like "RotateXDown.dsa 10.5" and have the value change by "10.5" instead of by the default Increment Value. In this way, I can use one script and just pass the value from the macro.
I've seen comments on how to do this from another script, but that just brings me back to the initial issue of passing the value in the first place.
Thanks in advance for any information, even if the answer is "Nope. Ain't happenin'."
/*DAZ Studio ScriptDecreases the xRotation by the sensitivity listed in the nodes parameter settings for all currently selected nodes. */var oNodes = Scene.getSelectedNodeList();var nValue;var nIncrement;for ( var i = 0; i < oNodes.length; i++ ) { nValue = oNodes[ i ].getXRotControl().getValue(); nIncrement = oNodes[ i ].getXRotControl().getSensitivity(); oNodes[ i ].getXRotControl().setValue( nValue - nIncrement );}
Comments
I don't know how to pass a parameter to a script, but for sure you can do it with 2 scripts - set.dsa and execute.dsa. The first could prompt you to enter a value, and then write that value to a file upon acceptance. The second script could then read the value from the file the first script wrote, and then do whatever you want with it.
You could of course simply edit the file with the value manually and just run the execute script.
- Greg
Thanks for the feedback! I noticed that you can actually run a script (or the functions inside a script) from an existing one and pass a parameter to it. The snag with this idea is that I'm still writing multiple "set.dsa" scripts. Using an input dialog is a possible solution as having the controller execute the script, wait a moment and then enter the value is do-able, though a less perfect solution. I'm getting the sense that the scripting system isn't designed for this.
Ideally, I would write a small plug-in in C++. I think I remember enough of it to kludge something out (though it has been 20+ years...) My biggest obstacle there is that everything I've read on setting up Visual Studio (or another IDE) is a nightmare as nothing has been updated in half a decade.
Thanks again for the info!