Sendin parameters to scripts through ExecuteScript

Discussions concerning programming of SOFTIMAGE©
User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Sendin parameters to scripts through ExecuteScript

Post by Pete » 04 Jul 2012, 02:10

Hi there,
I'm just having a little difficulty sending parameters though Application.ExecuteScript to functions within the scripts.

So say I have a script called "test" that looks something like this -

Code: Select all

function TEST(message){
	logmessage (message);
}
I could run it from within another script like this -

Code: Select all

Application.ExecuteScript("test.js","JScript","hello");
But how could i send something to the message component of the test script. I've tried adding it after the fuction name but it deosnt seem to work.

Any ideas?
Thanks,
Pete

User avatar
myara
Posts: 406
Joined: 28 Sep 2011, 08:33

Re: Sendin parameters to scripts through ExecuteScript

Post by myara » 04 Jul 2012, 02:52

http://softimage.wiki.softimage.com/sdkdocs/Application_ExecuteScript.htm

ExecuteScript ( script path, script language, function name, array of parameters )

The last "array of parameters" has to be an array. It won't work with strings even if you only need 1 parameter.

aParams = ["hello"]
ExecuteScript("c:\\test.js", "JScript","TEST", aParams);
M.Yara
Character Modeler | Softimage Generalist (sort of)

User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Sendin parameters to scripts through ExecuteScript

Post by Pete » 04 Jul 2012, 04:03

Ahh,
I've never used an array in Softimage before :/
That makes total sense now though.

Thanks!
Pete