Example of a JScript + w( w( N) k8 C+ X& P3 Z: B
var vbOKCancel = 1;
# t" C* Y* C- K1 {8 ~+ Mvar vbCancel = 2;
- i- O3 ~& Z( svar vbInformation = 64;
9 c9 } J' R2 [+ e/ O0 C% S s jvar Finished=false;
4 c; z) v: l: t# R" o 7 z) K8 c/ g3 J2 E3 I: p
var WSHShell = new ActiveXObject("WScript.Shell"); ; g$ ?$ r3 V2 e! c0 O' S- q
9 i- Z, R Z$ [8 |/ e2 A" {0 D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' S3 [. ]1 b% y/ B% D
/ R6 y4 V4 {* S
simple.SetLicenseType("Runtime"); ! @; V. O3 c% n, N
6 _) B0 W6 D/ u( [* Itry 1 y: y. h3 |( b' l, j
{
7 C' R5 Y" G" u // Enter the path to a model file! - |& H" p4 ?7 a% _
simple.LoadModel("C:\\Models\\Test.spp"); 3 f1 j2 B9 w) z
} 4 O" c. {; y8 w4 Z) D+ o
catch (e)
% `' O* N9 E: P+ M* A Y1 v: {{
! b3 P- z- k! S5 @: F* Q! A WScript.Echo("Could not load Model!"); - B/ s2 b( A6 o s# U
WScript.Quit(); e* |6 i* P/ M6 L8 z
}
( O/ p$ ]5 o- d" k" j1 _6 j ) A2 x. r# d( ^! |: W1 `
try # F9 m$ c' D8 ?+ H8 R, a
{
. v7 i' G/ Y) |* I2 _5 Q' s. v& W7 N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) ^2 w# y' K7 D# ?" x3 a. U r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( D1 D% L! c x' b5 u
if (r == vbCancel)
, g! o; e8 X+ G. Z2 ?& \ { & I7 R( v% e' G9 @% @4 E
simple.CloseModel(); + a* |4 V8 r% x& i( d
WScript.Quit(); % @; C- ?# y/ l) ~! |2 k2 d5 b
}
& x* c ~( U& [. `} ) F/ ?# l! K2 q) }* R: T
/ _* w. `; I: O4 |simple.StartSimulation(".Models.Frame.EventController"); ' \% s& o2 v" L6 A: a% c
1 I2 |$ A# W# `, u9 W: E# T5 Oif (simple.IsSimulationRunning()) , \3 ?: l0 o) R( M8 _( b* S
WScript.Echo("Simulation is running!"); 5 N3 I" ]+ s* n+ Z0 A8 E4 T
" ^) g" R }0 S( ^+ A. u/ t// Wait until simulation is finished
% O) j- C% J) ^ jwhile (!Finished) WScript.Sleep(2000); . p; u6 Q3 A+ W1 W: u x
: x, w& _# s) y) j. G" R
simple.CloseModel(); . [0 g* ?# J5 n6 ^. R. V$ @; s3 E- K
simple.Quit(); 8 i) l4 D: `5 f$ S# q' R
WScript.Quit();
% K9 D, E! ^, ~. |9 o, }1 e4 ]
. u2 t, L% y( W8 _8 D; g ' b6 b* a2 V7 u/ L5 P0 p& h
function RemoteControl_SimulationFinished()
+ {# G, F9 [/ V P1 g5 _{
/ j) [2 h" Q% X$ ~8 h9 u. `0 F WScript.Echo("Simulation Finished!"); |