Example of a JScript
+ h: r7 X7 L8 @# Q: evar vbOKCancel = 1;
) h4 S( {) [- V% r) A/ cvar vbCancel = 2; * t S# n2 y( _! A$ U. l
var vbInformation = 64; 1 R* D, ~* z$ ^3 d# M- r9 H" M/ f# O
var Finished=false; # l, F# w k- L+ Z/ u+ \/ J
% b% |9 S' \8 ^1 s* e! D& F) ]
var WSHShell = new ActiveXObject("WScript.Shell");
' x, j$ i9 ]* ?7 R$ F
' Z2 A7 Y0 n$ `6 M# @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% w& c. Z; O) @; S% H9 G& w& O* Q % k; O: m& z- [* q
simple.SetLicenseType("Runtime"); 9 Q0 X5 g J$ s' W
- R) ?3 E( ?. G+ k% ztry
$ ^5 s, W, ^$ ^2 M{
$ |8 `. ]4 B2 z4 T N; x // Enter the path to a model file!
, N/ E8 K" c6 f: v! W) m9 }2 Y8 I simple.LoadModel("C:\\Models\\Test.spp");
/ ]5 F9 ]9 ]8 ^2 R( o5 V} ; ~7 ~- U# k+ T$ i
catch (e) ( X1 F% y3 O6 Z) m
{
+ ]% f m) M. \, Q4 n& u, d WScript.Echo("Could not load Model!");
4 S$ P g- ~% d WScript.Quit(); * U7 N. R3 _/ E3 Z8 p
} ; S+ d! h) N$ m0 E. ]% x
; E( n6 b* e" U& }! D6 Itry 0 d; L Y( ?% s
{
: p' A7 y( G1 {+ J- |5 @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* \# d8 p, n0 W! Y5 g( R" C/ N# c6 K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' X& X& S8 p1 D8 {8 v% @ E1 K
if (r == vbCancel)
8 y6 o! L& [$ e2 i {
7 F$ I _- n& t simple.CloseModel();
* q. Y4 O; T( n' b! f WScript.Quit();
7 ~; X7 m6 x5 Y5 [! C }
" `: k4 h3 Q0 e2 B+ f2 K; `" F8 l} S4 G$ x- \6 m5 d3 ?. W6 |# d
; U; p9 p4 [3 v0 isimple.StartSimulation(".Models.Frame.EventController"); 2 N; w, f% ?5 ~0 F, i, O
) L! V @- w3 e) B( \if (simple.IsSimulationRunning()) 8 | F; p% Q j+ v5 c" u
WScript.Echo("Simulation is running!"); 0 `5 J2 H9 H" b
# ?$ d! p! \! a5 i" L// Wait until simulation is finished % z' I1 M& V7 A- q6 Y* w$ A/ v" A- v
while (!Finished) WScript.Sleep(2000);
: f. b& [: Y% ~& @/ _
8 `8 v5 w/ i8 }3 osimple.CloseModel(); ; B* G: i- b0 q3 }6 |
simple.Quit();
: ?4 q2 D3 V6 i' o9 ^ [, M: NWScript.Quit(); : v7 H p- E+ M* p/ ~) z5 |' ^4 s
8 b. k) _5 F0 o* L2 V9 I 6 W5 j( v* ~" r# E4 _
function RemoteControl_SimulationFinished() * E# s7 ^ T4 p2 w
{ 0 E" Q- a5 O, m
WScript.Echo("Simulation Finished!"); |