Example of a JScript
( f7 U% J/ C3 @var vbOKCancel = 1;
; m5 q. t% ^5 g: E/ f; X& Pvar vbCancel = 2;
& o7 z1 ?+ o; S" dvar vbInformation = 64; ' D4 B9 M; w4 z: V+ M
var Finished=false;
) C; F* _7 A9 ~1 U# J% A" |' V' k8 G % w& B, e( I6 R/ h5 k
var WSHShell = new ActiveXObject("WScript.Shell");
* V4 S7 ^0 U& H 5 a1 T r. t' J: T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# U" T! h% W4 d# B0 W
: @! `" N& f6 s1 Vsimple.SetLicenseType("Runtime");
. k1 t- p8 d7 Z* R
3 p) b9 V6 Q3 D% I3 M* `try
- H& H2 P- Q( ?! a{ ' o Q5 s3 K6 h
// Enter the path to a model file!
) p5 D- d% n& M0 W2 t simple.LoadModel("C:\\Models\\Test.spp");
0 G" }, D% U- m$ |} 0 o! @. ]" c5 s" W9 J
catch (e) - K3 m! W8 N+ y. a8 A& Z5 D
{
6 u$ g1 M1 T$ E+ p WScript.Echo("Could not load Model!");
) x& c8 G/ n4 d6 \& B WScript.Quit();
3 T. a& @8 r% O1 W0 j9 a% H}
; l) s6 v% j" J$ x# O
, X9 \& {& e7 p0 A0 ^* O: o* ktry 0 }" ^& A/ N3 @' K4 b; l
{ ' d2 ?" G! c$ u& C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - H* X3 y" M" |- m
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 c6 u* Z: E h if (r == vbCancel) 7 Z1 v4 L5 F: P* s
{
- ~( i) b) e0 U& y# U+ X simple.CloseModel(); / ]4 u7 ^. q4 z- A0 t
WScript.Quit();
& G5 S) l! N: F- V8 U }
5 y" L* G+ d+ b E2 U8 F} # l& p5 F7 x" _6 g7 o7 N$ O
9 }% s1 B7 _7 e; E) zsimple.StartSimulation(".Models.Frame.EventController"); 8 @* i+ \! V( O1 G w d1 k
1 j7 z e& g5 E* @) L- Tif (simple.IsSimulationRunning()) 4 E5 Q/ o' Q8 ?# V, c2 s4 i7 l
WScript.Echo("Simulation is running!");
) v% e" h+ y3 i1 D: I" n. O
8 }4 J; B; `8 C# T% R& h& X4 d// Wait until simulation is finished 7 j: W! H. A1 A- y9 k) g! Z
while (!Finished) WScript.Sleep(2000); # A, K' n8 [- B/ V% d% b6 z
/ O: s9 l) q K: m. A- \simple.CloseModel();
" V! E/ ?: B! _0 X5 U' T ~simple.Quit();
7 t }. y* S- a2 @WScript.Quit(); % g" U. w3 N1 ~6 F# ]! w; X F
! v5 n; e9 Y. l5 B. p8 [3 ~6 U 2 i/ O& x) e# x1 g/ V0 N
function RemoteControl_SimulationFinished()
" e4 ]0 w1 o5 t- P3 X2 Y, K{
M T, {; ?: S WScript.Echo("Simulation Finished!"); |