Example of a JScript
& n$ O! K5 y: b/ Dvar vbOKCancel = 1; 4 V2 Q( ` D; j% P$ R$ U! @: s
var vbCancel = 2; 6 ^5 ]2 b' \- V! [# B! _2 I
var vbInformation = 64; 9 h. d6 N2 T+ o* ]3 A4 Q, |( j
var Finished=false; ; R$ S6 P! U( F& a! H
9 x0 v% l l. [4 {) mvar WSHShell = new ActiveXObject("WScript.Shell");
' _6 M* {$ T$ w
+ a5 e; l) D1 [( xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : d% u& I; L7 m6 q
% \' B; n5 R0 R7 \
simple.SetLicenseType("Runtime");
# K* l: P- d/ O! a
: z( z4 S% s3 U9 Q$ Y+ h/ f6 {try
( c; {1 I- C9 D, P) I! K0 o{ # v; H2 n0 N$ ?8 l6 I) o
// Enter the path to a model file! # ?7 s- u2 X, B! M# q" F
simple.LoadModel("C:\\Models\\Test.spp");
9 }9 Y N/ {$ c} ) ^# P2 r/ j/ [4 j* C
catch (e)
' ^" Q T6 Q4 d" q! w( U; Q2 N{
( g% O8 V0 ~7 M; l" n! p WScript.Echo("Could not load Model!"); # n* ^) {; G3 Y# {+ N
WScript.Quit(); * k2 Y+ F( ?9 ~. T0 G! D
} 4 I7 L5 S" _) ]3 `$ u: y
: m$ M# { j1 l8 ktry
; A& {5 t8 D1 _2 p: h! J{ 5 W% x& o( E% T. b7 V
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . L( W4 p8 E! n6 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 q1 |* H, `/ o- |) S if (r == vbCancel) ; A. ]$ H L% R- F) y( e! o
{ f4 i4 c/ m( W g% g
simple.CloseModel();
% V+ h* j6 N0 Q0 X0 n1 a# f WScript.Quit();
" z7 Z0 z5 w8 c } 1 Y: D9 |! f3 m5 M/ V. N% q
}
4 R0 r! m, Y; Y$ c 5 f# A, n- M/ B
simple.StartSimulation(".Models.Frame.EventController");
' l/ F# c( O: { % S' y/ ^( L* l& m; N
if (simple.IsSimulationRunning()) : U, U; A1 i3 g$ c7 G& b
WScript.Echo("Simulation is running!"); , w) W! T6 |3 g+ w: x
\' z2 x; m# v" }// Wait until simulation is finished ! U. q6 F! w6 Y, W
while (!Finished) WScript.Sleep(2000); 1 C$ x' w. S4 @% L0 i, f1 {
$ Y O7 j2 D# F! Fsimple.CloseModel(); & E- [1 ~2 w6 ~& n: y( E
simple.Quit(); , l/ {1 q" f& q
WScript.Quit();
# d: F3 m$ G" `7 u/ s4 o, B + ?; b- x6 n; D' G% n
" L$ G5 {# J9 K( g$ yfunction RemoteControl_SimulationFinished()
+ X# z0 r/ I& o# S4 l' Z* Q2 E{ # t9 Q- |0 D/ C( P! j/ r
WScript.Echo("Simulation Finished!"); |