Example of a JScript
7 @9 U. E* H5 [% pvar vbOKCancel = 1;
\, [+ m+ Q" F* k; l' t$ L0 A" evar vbCancel = 2; : R. f: `4 G! h3 K% A1 v! m
var vbInformation = 64; ( k" y$ P2 A) a& O
var Finished=false;
- g; V) K6 Z. d. p # N) ]; y4 U. }1 w6 U7 C* D" k
var WSHShell = new ActiveXObject("WScript.Shell"); Z0 }9 J, ]% h; s' ~8 s
+ T- B# U. m4 P: \8 Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " K: ^# @% ]: A' @; d# B
6 |$ ^1 \4 y) h5 ssimple.SetLicenseType("Runtime");
n4 {& M& {% X5 T; t3 N" { % G: p& m3 O% Z$ W4 E- y6 ? [
try " m, i8 T& Y5 l' D; t. y `* @
{ 0 Z1 R1 f7 t5 ~6 ?" d
// Enter the path to a model file! . D4 z3 a, [3 e5 ]
simple.LoadModel("C:\\Models\\Test.spp"); & W- w7 i2 k! M2 Y1 Q) v0 u2 }) T# e
}
( \! P1 \& x1 i; ecatch (e) + Q# E+ h, M4 E2 O" M7 X, ~
{ # r7 J# l- ]) N3 T
WScript.Echo("Could not load Model!"); 3 @) D+ d, _# e: Z9 x
WScript.Quit();
! D. |7 M2 ? h, e& q( }2 y8 p} h% e* t4 ` X/ K) _0 v# H! ]1 T
1 z$ @2 \+ _! ~- |% B+ u+ A1 btry
; S* _# r! k3 V7 \% g6 M# U{
! Q* T7 S' k1 }5 l( K9 z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " u( W+ q% L3 P/ d2 n
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - k7 o% q1 y+ ?7 } t2 k" C
if (r == vbCancel) * P. ?5 u+ O2 _$ A2 v: {$ J
{ - e, V' \ d4 G/ a8 |/ T
simple.CloseModel(); , H! A7 b) b+ r+ b/ }& [7 E
WScript.Quit(); " t% g) `7 Z! }/ P6 S4 [
} + f4 U G% ^8 V0 }, q# _; _
}
2 ~- G* v6 V" q# J, h3 J& H9 \
5 r& H% E! I! t3 J% a% {; csimple.StartSimulation(".Models.Frame.EventController");
( P0 s6 k3 Q: h( s* g0 m1 W / J/ [* _+ G9 u# R
if (simple.IsSimulationRunning())
8 \$ }/ }! W/ F' t! T7 V8 v( p WScript.Echo("Simulation is running!");
/ I- c5 h" |6 _' x/ T0 H
. b+ i {1 L4 x$ m// Wait until simulation is finished
. r m& E$ I3 x1 w- w5 owhile (!Finished) WScript.Sleep(2000);
]' a8 D7 k9 c# i+ T7 f
% o5 Q) E4 S0 A. b- Fsimple.CloseModel(); ) L9 `1 d) r7 u# z1 k
simple.Quit(); 6 {; p9 s6 m% f* T4 T5 ~' X! h
WScript.Quit(); h9 k7 w* [# R: o: V& Y7 [2 K
3 h, U3 P! O1 I) }2 n Y4 |( G 2 F9 g" d6 L; }
function RemoteControl_SimulationFinished()
! a( G1 O8 e5 `4 x5 y3 x! W. O{ % \2 n% u- h6 E$ B" {3 b
WScript.Echo("Simulation Finished!"); |