Example of a JScript
/ F* p: t$ Z$ ?! t% Ivar vbOKCancel = 1; . K; c6 {! k% ~5 X6 j' }
var vbCancel = 2;
. L% V0 D9 Z/ X/ Yvar vbInformation = 64;
d- S* b N$ {5 c# l2 |1 Y! d: {var Finished=false;
4 u' g }) M7 d9 U$ J ) y; x3 \' a3 Z- j
var WSHShell = new ActiveXObject("WScript.Shell");
* b0 Q( x& L5 V4 D7 U+ j# g * A! ^" |& M2 y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* L- x3 o8 n6 [ ; X$ u, F" d* k6 V9 t
simple.SetLicenseType("Runtime"); + m* h0 t; c; _, i" J o9 \6 J
/ F; R& D- j7 W2 \7 htry $ h* [$ C) E7 k" y8 Z6 b% x
{ 1 O2 ?5 a& W6 O/ |) W' Y/ m
// Enter the path to a model file! 3 V$ f7 A: I7 S
simple.LoadModel("C:\\Models\\Test.spp");
- `% B0 Z D) x; u, ~}
# C- }' \% l" a- H n" ocatch (e)
8 Y6 C8 N# ]5 T4 F, [" e{
! G* {( z( V& O2 s) j) i3 a WScript.Echo("Could not load Model!");
6 b7 m1 n% L0 k9 B* n1 @ WScript.Quit(); % o; a9 X6 T$ p. ~
}
" N9 f/ R, ?. u0 V, X" q * L* [5 e* D6 D8 W; r+ B0 M6 j
try
% f% i( T( b& \& e{ ' ]& ?3 s& x4 d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; A& R) F4 R4 j8 n8 E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 o- P4 h0 v' D* t7 V9 `( A9 V4 z
if (r == vbCancel) 2 J' x, P0 \8 d! E/ F* z. d
{
" [& G7 E5 e( Y; j simple.CloseModel(); $ g+ l1 J1 M3 n2 `( n" ?
WScript.Quit(); ) e7 I6 O }* D4 s7 L- k
}
% {/ y8 T$ G9 M) m. R4 O# H}
2 g. j5 e, ?( Q7 O, |
" V. T, f M( g9 lsimple.StartSimulation(".Models.Frame.EventController");
/ T0 b2 s: q% o% c
! ]7 Y. R4 P5 Q, \# Tif (simple.IsSimulationRunning()) # B) j1 n, i. D" g- D2 n
WScript.Echo("Simulation is running!"); / N' K/ N" r9 z( z4 H. m0 s" K: d
- N3 E" O p3 t3 w! _9 b8 h' q// Wait until simulation is finished ' m, ]' B7 Y6 A$ @* K
while (!Finished) WScript.Sleep(2000); ' M* o& \( T( n# ?- Z
9 j5 d$ i7 X0 C4 o$ xsimple.CloseModel(); , N7 M ]4 ]3 }' L2 M. l! s ^
simple.Quit();
. K. r2 O: e }WScript.Quit(); - ~: D; C! T; F& O4 I
. e1 `6 d: a4 w# G! u! N6 u
8 V( s6 R. L& t Bfunction RemoteControl_SimulationFinished() 2 `0 L- Y1 |) |; Y) Q3 Y. M
{ 0 ~( U6 R5 Z2 a+ q' b8 u
WScript.Echo("Simulation Finished!"); |