Does anyone know how to call a normal script using JavaScript??????
Thanks
Does anyone know how to call a normal script using JavaScript??????
Thanks
I've not found a way to do that. What I have done however is use the script as a wrapper around the javascript. In otherwords, your script would be top-level and the JS would be called from within the JS. After that code is done, the script will finish and continue on to other panels if set up that way.
I've wanted to call RAD apps from JS but had to use Process panels to achieve this...again calling the JS from the Process panel.
Jeff
This would also do it.
//Execute script
function Java_ScriptExecute( scriptname, record )
{
var rteReturnValue = new SCDatum();
var argNames = new SCDatum();
var argVals = new SCDatum();
argVals.setType(8);
argNames.setType(8);
var argVal;
argVal=new SCDatum();
argVal.setType(2);
argVal.push("name");
argVal.push("file") ;
argVal.push("boolean1") ;
argNames.push(argVal);
argVal=new SCDatum();
argVal.setType(2);
argVal.push(scriptname);
argVal.push(record) ;
argVal.push("true") ;
argVals.push(argVal);
// print(argVals) ;
system.functions.rtecall("callrad",
rteReturnValue,
"script.execute",
argNames,
argVals,
true);
}
Java_ScriptExecute ("name_of_script", record)
No friggin way! I've never heard of the "callrad" RTECALL. Is this new?
Very cool by the ways...
callrad is one of those nifty undocumented features. I believe the last manual it showed up in was for SC3!!
There are further examples of how it's used in JavaScript in the KMUtils ScriptLibrary record starting on line 197 in the domessageBox function.
Keep in mind though, Support is going to be very limited for this particular rtecall. Chances are if you're using it, you're going to be on your own if something breaks.
Former HP ServiceCenter Support Engineer
if ( $meetings > 0 ) then ( $productivity = NULL )
"I don't do whys." ~Dennis Markum
Hi,
I've heard that they have removed some of it does not work in SM7 any longer...
Lars
The first rule of 'callrad'... is that we do not talk about 'callrad'.
//BEGIN EDIT
But since we are talking about it...
callrad
Parameters:
ARG(2) - Return Var
ARG(3) - RAD application name
ARG(4) - Array or scalar of Names (of parameters from the parameter form)
ARG(5) - Array or scalar of Values for the names
ARG(6) - Run this RAD app in a new thread or not
ARG(7) - Condition for executing this RAD app
I haven't tested in SM7 though... and as ResidentGenius mentioned, this would definitely NOT be supported by HP Support/Dev and thus really shouldn't be used within production systems.
//END EDIT
Last edited by benvargas; 2007-12-02 at 04:05. Reason: Added Info.
Hi
I am trying to set an Array() object,can anyone provide a sample code for that
Thanks
Dinakar
var a = new Array();
a[0]= "First Element";
a[1]="2nd Element";
...
a.push("New Element at End");
...
Why should this not be used in production systems?
Oh, OK. That makes sense.
But it is still a nice little java function which I will use and when/if HP changes callrad in future I will address it at that time.
I hope HP will not abondon this function - it is called about 4 times in script library. So they use it as well.
My question:
did you ever managed to have something returned in rteReturnValue ?
I have twisted my brain many times and did a lot of tests - and got nothing.system.functions.rtecall("callrad",
rteReturnValue,
"script.execute",
argNames,
argVals,
true);
The debugger (at least in SM7) crashes when I trace the variable.
regards
Artur
Hi,
Nice script and very useful! I try to use it from a trigger. For testing purpose I cut and paste it in a script. But I 'm experiencing trouble when using it. I use the system.record to call the function instead the record parameter. I also have an error on the third line "Script <UNKNOWN> line 3 : ERROR Unknown RAD symbol '$file' au car 1". Does anybody has a clue?
Thanks
I am not sure if it is possible to use it in trigger.
Post your script - BTW.
regards
Artur
The script is exactly the same as above. I call it like that:
Java_ScriptExecute("myScript",system.record);
You should put all your javascripts in Scriptlibrary and call them from there like this: system.library.scriptlibrary_name.function(paramet ers)
As Artur asked post exactly what you have in the trigger because there is no $file in the above script which your error message is about so it is not exactly like the script above.
Here is the whole javascript, It is saved in a script and launched by format control. The other script (myscript) simply displays a field from my form.
function Java_ScriptExecute( scriptname, record )
{
var rteReturnValue = new SCDatum();
var argNames = new SCDatum();
var argVals = new SCDatum();
argVals.setType(8);
argNames.setType(8);
var argVal;
argVal=new SCDatum();
argVal.setType(2);
argVal.push("name");
argVal.push("file") ;
argVal.push("boolean1") ;
argNames.push(argVal);
argVal=new SCDatum();
argVal.setType(2);
argVal.push(scriptname);
argVal.push(record) ;
argVal.push("true") ;
argVals.push(argVal);
// print(argVals) ;
system.functions.rtecall("callrad",
rteReturnValue,
"script.execute",
argNames,
argVals,
true);
}
Java_ScriptExecute("myscript",system.record);
The "record" in the example is it an array? Like we use it in subprogram to launch the script.execute in file parameter ($file)?
FYI my system is SC 6.1...
Thanks
Now I am confused, you first said it was called in a trigger now you say its called from a formatctrl. Which is it? Take it from the top and list all changes you made in which elements one by one.
I have put all the function and place it in the scriptlibrary as you told me. I still get the same error. In fact I want to test it before paste it in the trigger so I use from the format control the script.execute to launch a script and from the javascript before RAD section call Java_ScriptExecute function from the script library. I didn't made any change from the Iomah's code. Could you please give me the type of each parameter because I don't think using the right.
Try to use:
Java_ScriptExecute("myscript",vars.$script);
or:
Java_ScriptExecute("myscript",vars.$L_file);
or:
Java_ScriptExecute("myscript",vars.$L_filed);
As Tomy - neither I have understand what you are doing
regards
Artur
Last edited by Artur; 2008-11-04 at 16:54.
Its hard to help without seeing exactly what you have done. So please again, list exactly each step you have done.
And why do you call the javascript from a script in the first place. To test the javascript you just add the javascript call in the calculation part of the formatctrl. Then you skip the extra and unnecesary script part.
I have tried both... Still the error message. Do you think it could come from the system?
I've found thanks Artur for the clue! The trouble came from the script called by my scriptlibrary... We are in script and all my variables are referenced by $script not by system.vars.$L_file nor system.vars.$file so it bugs. Thanks a lot!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks