Is it possible to pass an object to a script addin and how?

I am trying to figure out how to pass objects to a script addin. The option seem to be all listed here https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Argument_Types.htm I have tried a few like k, m, and o. but they don't seem to work. So before I beat my head against the wall some more I wanted to make sure that this is even possible.

for reference this is how I set the template.

cmd.template = "folderCleanUp/k,";

and the code that calls it looks like

cmd.Runcommand('Helpers folderCleanUp ' + selectedItems);

So you're calling one script from another script?

You can store some objects into Vars, then pass the script the name of the Var, but it may also be easier to simply move everything into a single script where everything happens. One script can add multiple commands.

I have a lot of functions that I end up using in many different scripts, and I thought if I made a script addin that had all those "helper" function, then I could just keep all the code in one place. Currently when I find a better way to do something I have find every place that function is used and update it.

So you are suggestion that I just make one master script that then has the commands to call instead of making all these other script addins that I have been doing?

That seems like it might be much smarter.

That's what I would do right now, if you have large amounts of code that you need to use in more than one thing.

We're thinking about a way to make script code re-use easier but I'm not sure how it'll work yet.

1 Like