Example of a JScript * Z4 P: H1 D) }1 a' i7 l
var vbOKCancel = 1;
0 s s+ B( A! z3 R; i; N- X* @9 Hvar vbCancel = 2;
' C* F/ I' _+ a* m q! x$ }var vbInformation = 64; 4 F7 X- ?7 D$ }+ Y: }
var Finished=false; $ S3 r, ?" t0 @8 E
3 w7 X; {, l3 n& }var WSHShell = new ActiveXObject("WScript.Shell"); b6 {- y1 @: ~; R9 D7 G3 z% g- s
" ]9 Q1 K/ O' p- D2 h! r: o% z& o0 g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / \$ m }+ f$ y, D
" \2 g( A$ f: b! L7 T0 p9 ^simple.SetLicenseType("Runtime");
: d( |* Q: l% Z, c7 ^# ]4 v
7 \$ y- m" }4 D, ctry 7 F* J: j, A+ L, C9 x- m
{
6 k4 Z; a7 g4 f0 n, `* a // Enter the path to a model file! ) C* X: p% c9 b' I* [7 y
simple.LoadModel("C:\\Models\\Test.spp");
& u0 j+ ?* A0 W9 ]* C$ Y7 z* Z} 5 |# ]% g0 p8 M4 X2 V: P
catch (e) ' _5 Q# V- ~7 a' ^
{ 0 d! Y8 g& [, e/ N; V
WScript.Echo("Could not load Model!"); # O N1 Y U1 `& d+ \ s+ |- r
WScript.Quit();
" T2 {/ }) d) {' ?}
: }, ]$ c- C* z6 N' l ; T* q5 {2 ], z% t1 l
try
5 u6 M. r: r# s) Z# p{
4 s2 ~. H' r; J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% V, L0 q# ` p0 ~ N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( Q+ G; f/ r( h; j e) Y( b" A* O
if (r == vbCancel)
, l3 m8 y( E+ A. l1 \2 j5 M {
& y5 L0 t+ F& Z) p! V1 w6 ~ simple.CloseModel(); 6 p7 c8 t7 b2 a- f0 W% o: G
WScript.Quit();
8 z) ]2 ~6 |8 `9 C }
8 q8 e6 O4 H- C' B# R}
; E9 N Q) G. ?, }$ N
& V. W. p7 R/ Z c8 \simple.StartSimulation(".Models.Frame.EventController"); $ P" n( c& B. M3 [( j
$ J3 P% \0 V7 O" p$ c7 m) aif (simple.IsSimulationRunning()) * k6 {: M5 m, i' E; m
WScript.Echo("Simulation is running!");
6 k+ Y% r/ u, y9 a K- z
5 a0 V% r. d% {) i' `0 b. m& n2 h// Wait until simulation is finished 1 v: t; v: {8 S
while (!Finished) WScript.Sleep(2000);
5 A7 l2 Y! S) [- | A " D$ ^" j0 t0 d3 ^
simple.CloseModel(); ! q# O Y/ C( E6 r9 k* [( D
simple.Quit(); + }1 E% ^$ S+ x3 w. A" _
WScript.Quit(); ; O3 Q# Z- n) G. f1 t( a
/ s* y5 l0 V4 g) `0 F! K
, C }0 w+ j5 C% a* j+ Ofunction RemoteControl_SimulationFinished()
& N9 |7 l( M C+ K% o8 Y0 F+ x# `{
9 f) T+ Y1 o/ I& l+ S/ L: Q WScript.Echo("Simulation Finished!"); |