Example of a JScript
; K f! ^0 y! f+ m D( C8 b3 d% }var vbOKCancel = 1; 1 b: k T: }! I( O
var vbCancel = 2;
8 ~: C8 T: U1 c# E6 M7 Y) evar vbInformation = 64;
4 n9 Q2 e3 V9 R: d! A! t& f7 Jvar Finished=false; + N, K1 A$ @# _
4 I }; O# v/ G6 F& r
var WSHShell = new ActiveXObject("WScript.Shell"); : l- ] u, W( b: A' _2 B0 {, v
: f0 B: @5 p2 M& m3 t* M5 r* }" n8 h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 r @2 S! B8 a+ y( {$ p
|, O. h2 g7 L+ F3 P. M+ Z- p& P
simple.SetLicenseType("Runtime"); 0 R2 s @ y# [& ?) ]! K' d
6 u- [- q7 k5 g r8 q4 j& Z
try ) H0 A+ i( y* J. ^( T! S+ Q
{
4 X M8 y! V2 n2 _4 r9 B // Enter the path to a model file! : a8 Y7 P9 n$ U% o8 Y
simple.LoadModel("C:\\Models\\Test.spp"); * V# t( }1 a# ?
} # x9 `3 g/ t1 _, `" ?, {
catch (e) ; W; P/ ^+ S1 ]
{ ; ~& f! d* x. S" ~- K
WScript.Echo("Could not load Model!");
, c: \. o# |# ^4 l5 `" q WScript.Quit();
) O/ E; V8 @1 a} 4 x/ D$ D! C" x, n8 V. p8 `
" H5 v; H1 }8 m" Z q
try
6 ` p* d. K" v. b$ y7 f3 X3 D0 ]{ , U3 f$ P4 W# R9 Q, ], R8 W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ u x2 c/ K/ J: q& o' K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. s _7 C4 W1 y8 _0 Z8 C. M if (r == vbCancel)
) k7 P' F4 X! f% o2 R* I {
% `( C I4 J5 H# g+ k: d9 ~ simple.CloseModel(); ( n. e5 ~, q9 s; Q, c
WScript.Quit(); # Z$ e; \4 }1 N2 t( l
}
2 n& f! [/ K; d$ p$ n5 s9 ]; J& v/ `}
+ f0 v4 s% ^# p9 g i' u & D& e' S2 ^! A( H' X
simple.StartSimulation(".Models.Frame.EventController"); ! C' x$ M6 `5 h" q/ J. O
t5 U! B' s! M9 n5 Qif (simple.IsSimulationRunning()) ) ^- u" x, t% L2 s8 _( x
WScript.Echo("Simulation is running!");
# W* P" j# Q) O) j
/ W$ r' F$ Q2 G# |& Z// Wait until simulation is finished 1 b" K8 [6 V! ? N4 d1 i: w5 v8 s" {
while (!Finished) WScript.Sleep(2000);
# r; \7 `+ C. [5 `6 g } " `0 a0 t5 C: d+ @
simple.CloseModel(); ; z$ |" J9 @. N% K, g$ ^" @
simple.Quit();
0 a+ Y$ R5 s7 e/ _) cWScript.Quit();
/ z( {# o0 c- h x 5 @; C2 n1 d4 B7 I! P; ^, S
c' M1 h1 |3 p3 Afunction RemoteControl_SimulationFinished() ! q' g3 C. w t, p3 g
{ + o0 {! l9 D% E( f1 i/ M/ q& [9 M
WScript.Echo("Simulation Finished!"); |