Example of a JScript - i( o; ]7 v: V( `: Y3 U `
var vbOKCancel = 1;
% |* U& w5 n- z! `6 a8 hvar vbCancel = 2; ' j' p1 u: x0 S* B7 e! K, K
var vbInformation = 64;
+ N4 g# E: n) W% O$ s* uvar Finished=false;
) T/ c# W5 A6 H1 z, _- v7 I
! k/ u2 x$ c3 D/ A3 @var WSHShell = new ActiveXObject("WScript.Shell");
* v; ~: g3 X# p0 b4 B$ Q5 W$ V $ u" N1 |6 C; [) y7 ?/ D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " d+ L, q! S8 u0 y, |
& ^3 \' E( s1 V# ~
simple.SetLicenseType("Runtime"); + J2 ? V# H K5 `% ]# e
q( p1 m: u f6 a) V
try ' o1 F+ J8 [. b0 M7 i$ E/ `% g
{
, c. w# e# b3 @, z // Enter the path to a model file! ( @- u. ]6 x8 T
simple.LoadModel("C:\\Models\\Test.spp");
4 g7 x+ V1 ?" Z5 l v! Z} . |0 V% c% F9 S( [2 ~
catch (e)
$ e2 z$ y5 J0 ]( h{
2 J9 r- V! O1 x+ [5 d4 p: j) X WScript.Echo("Could not load Model!");
8 Y) r0 G+ k; @ WScript.Quit();
: S1 {/ K. W# D! }- K} 8 G1 ?4 N* j% [6 H
* \; a1 q% W# X( R* Q
try
: h# R/ Z1 H: h0 o! j{
& W. G- z/ ]: d6 I! F6 d* r/ I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 _# P2 b) H6 R9 w5 W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 i7 W. H- T4 j if (r == vbCancel)
! e) m* e- D6 e- x5 C# y7 b8 l {
) h M9 _. D# Y. a& g. L simple.CloseModel();
9 q4 _3 w& O! o0 X WScript.Quit();
. o( R1 M% ^7 _$ H& ~( G } & C5 G8 ^9 i" A; A6 l
} - O$ A4 _5 h- p* F% O
: u% N9 m. q9 E5 ?% L# m* P
simple.StartSimulation(".Models.Frame.EventController");
: W6 w6 f2 ]9 C5 B8 t* D# r/ E M 1 W( B- t, b5 X+ H8 d
if (simple.IsSimulationRunning())
$ Q; j t; s* j. H) `! k( N WScript.Echo("Simulation is running!"); 1 L* ^4 C [! T6 x2 L
# [! n- s+ U7 P" ]1 x% o# n// Wait until simulation is finished 4 T$ Z% k: g4 f0 E
while (!Finished) WScript.Sleep(2000); ( p1 R# O& s) ~
7 K3 R7 r, h/ V( I5 E
simple.CloseModel();
3 e( O9 @9 W7 r( V3 |simple.Quit();
# y6 `0 c1 w6 V! o5 [WScript.Quit();
# @: _1 [( E. T
2 k: B u8 `* h: n+ a, B6 o! }
7 S: _2 i A" ]- T& Kfunction RemoteControl_SimulationFinished()
y5 I# |$ V. S4 V0 o8 P, o{ ; A0 C: ~ ?: |& V
WScript.Echo("Simulation Finished!"); |