Example of a JScript
* I/ b$ ]8 J0 V- jvar vbOKCancel = 1;
+ A# i& C$ e+ M( g bvar vbCancel = 2;
, a" {' [2 Z3 b" W3 Qvar vbInformation = 64; 3 M4 E" J L0 U' ?
var Finished=false; ' z3 @4 N- G! k; v+ z4 J8 m( c* v
' o- @( M0 n x5 T+ `; O1 |2 dvar WSHShell = new ActiveXObject("WScript.Shell");
) Z) R! n$ t X: r+ Z' @) F5 V0 n ' o$ B( K$ v# S; X: f& c% P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); W2 i5 r' ~# H
- |: ]$ O: e+ y0 N1 C
simple.SetLicenseType("Runtime"); : B% J; ?# f: y! f5 K2 X2 a) K
4 `+ ]/ S$ M0 b3 ytry
+ S5 m6 c8 X* f) r9 O{
4 K, B8 ~0 {: t: l // Enter the path to a model file! & [$ o' n8 `! ?8 Q
simple.LoadModel("C:\\Models\\Test.spp");
* c( G) R# e3 m* u, x& H}
$ s" d6 b% Y. v2 Ycatch (e)
" {! U6 U9 ]6 `% @% Q{
( `( P6 C8 H* f O! w. T WScript.Echo("Could not load Model!"); " n o m! A6 Q+ R0 X
WScript.Quit(); , H& `2 w- n! p% o, c. a
} 9 u0 G4 f) x) Z U
2 A- D1 s) L( c: \: ctry + t2 c. G$ W( Q* S! i4 Z
{ # A2 R# s& H5 e9 ]3 ^8 `! b5 J7 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. u* z4 V# j' y/ c$ z, [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- T {2 J) ?4 v0 v if (r == vbCancel) 3 U& I+ Q: p$ ^
{ h5 K6 r: o X2 E9 q0 w1 I
simple.CloseModel(); 1 [" G9 u, X% M' z2 F) ]- O
WScript.Quit(); % J" m0 { Z& t: Y5 \- R
}
/ |. |) t2 p4 M# s; V} ; Z+ c, ?1 X8 z
& b. y0 g! j2 Y: M- o1 vsimple.StartSimulation(".Models.Frame.EventController"); 7 q3 O: n9 E% o, N0 V. `- H
8 Q) S. B4 P( W# Eif (simple.IsSimulationRunning())
( C1 k, k8 X" `# d M, q, b WScript.Echo("Simulation is running!");
# x, X* h. `* L* t5 w# C
# l* p7 U9 t' {* A1 h* S8 M// Wait until simulation is finished
0 R# a& G: B* s- p& wwhile (!Finished) WScript.Sleep(2000);
, x- E7 E; S$ ^8 k; p! j ( c8 ?2 G5 _9 w# V+ E5 L4 d
simple.CloseModel(); 4 r5 `) g% S. w0 J$ P& u- v
simple.Quit();
5 M; A" T8 u4 Z3 n6 X$ @WScript.Quit();
% Z1 G, W( [' V" |% s8 O0 q h 7 |+ L0 i- e- ^1 W# R& I8 D
3 |0 f( `3 ]8 V: h$ n" Q, P/ S. Y7 dfunction RemoteControl_SimulationFinished() # ~* o# j4 n5 O/ y M: ]. ~
{ 3 M9 G" w3 d4 |4 A* E& V
WScript.Echo("Simulation Finished!"); |