Example of a JScript
; p ^2 S* y; c$ t+ j' `6 Nvar vbOKCancel = 1;
" ?4 c9 r. g% E; K' Evar vbCancel = 2; # S9 W6 f4 q, p7 j3 \1 b; V' G
var vbInformation = 64; ! {+ i( x1 C2 z8 X! r1 g
var Finished=false; / I+ O: A6 p. N+ j7 x
2 Y9 Y9 _0 Y$ u4 w. a9 Xvar WSHShell = new ActiveXObject("WScript.Shell");
6 t& F8 ^) Y- \$ `/ m + z6 K y: q: t7 \" n+ i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) a& I5 `" @ {- H/ X) [! ]
3 R( l# `9 w8 d/ M! s
simple.SetLicenseType("Runtime");
+ v1 i1 o' y9 }0 K 3 B3 x0 \5 t/ v& n+ h
try
* c5 ?& K8 x# O/ k6 i# N: z{
& _. v) h2 a! o ]' Q9 T- b* a) e // Enter the path to a model file! & T$ c0 q+ Z/ P6 g7 ^+ r4 s! o
simple.LoadModel("C:\\Models\\Test.spp"); . \8 o, L& B6 f( x# r7 z# ?
}
9 Q- a+ H1 D; z9 ~# \catch (e) 8 k$ V z; `. }) c7 |4 m
{
, }* K: L6 w) R' d+ y. J WScript.Echo("Could not load Model!"); $ [) l+ ^8 A- Y' P& R& @) W- r
WScript.Quit(); : T3 F! c [8 J3 U" k+ d
}
5 E& p7 X1 Q( p7 U3 i% t 6 m/ \! M" }4 f5 {3 ^% ~' W* t. l
try
* ]' O- c* y6 N# y+ `{
% i6 y6 u+ n! v3 i% P) h# ]( Z: d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: {- T( d1 R1 i6 I0 S r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% l8 ^$ @7 V7 C. E; S- A; N5 n! M+ f0 j if (r == vbCancel)
( M5 Z+ j9 l3 b$ E& t6 z& [ {
: Z4 W5 b6 c7 o) e0 ^7 X+ L% l simple.CloseModel();
$ x3 z; \1 I! J WScript.Quit(); ! w' }* |# d* a$ L
} 6 T5 S$ F5 X; i8 B3 j; k0 z
} ) d2 J: j. \5 N' s; K; W9 u% P6 x
1 h, G- v: e X o
simple.StartSimulation(".Models.Frame.EventController");
, J7 |2 ~0 i, A7 R# {+ p& U# m
( n* h+ K: b E. `& j0 X; w6 s6 I3 R+ rif (simple.IsSimulationRunning()) Z+ {4 _2 C0 t+ K0 X: B' m
WScript.Echo("Simulation is running!"); - k" z5 l: S! H/ q2 C( s4 D
7 b1 z; P; |' J* j! D- V
// Wait until simulation is finished
+ Y2 @ D, B- ^8 ~$ ?6 ?while (!Finished) WScript.Sleep(2000); ( F( i1 K7 H: ]
: F0 a8 r- h3 g% r% r" A
simple.CloseModel();
/ I$ r$ y; j# ?simple.Quit();
$ R8 p/ }" K2 f/ w1 E- C, C! EWScript.Quit();
3 m5 }9 |! T: p+ w6 X# l
1 n5 I$ B; L/ N, X5 p l
3 B) |4 H8 k1 b5 {- A% I+ I! Y7 f9 Gfunction RemoteControl_SimulationFinished()
2 A: L( ]1 t, b{ 0 S& W8 v- T6 |
WScript.Echo("Simulation Finished!"); |