Example of a JScript
1 N& c2 R6 S! V' {var vbOKCancel = 1;
) ~- E2 t1 N# c& P, J3 Fvar vbCancel = 2;
# d+ x) ~+ }9 h K/ H- \var vbInformation = 64; ( c. S9 O6 C0 j1 @
var Finished=false; 4 g( T3 r M; i d) O+ U) N" `
# A9 Q, @) W* E& B- H1 r/ C
var WSHShell = new ActiveXObject("WScript.Shell"); + l, P' O3 j. F' I; `
$ U, C0 ], {: A6 y8 J
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " d4 \$ A8 y. {4 P! F
: h% n& O6 P( Z/ R
simple.SetLicenseType("Runtime");
* \! e4 y% t- j# Q: M+ P! [
8 v- S; g) i& ]- o1 c$ Otry , K8 \3 ?$ R k' I, E
{ l% o! H0 D! `$ F; \
// Enter the path to a model file!
9 z. n' _: P8 S, s simple.LoadModel("C:\\Models\\Test.spp"); / N. ~: l. p1 N# m
}
7 Q/ n* @7 L I- k# T& R& {catch (e)
# [" v2 S# h( s{
% n% D$ M- m* w- A% E WScript.Echo("Could not load Model!"); ( Y: u- v& `" l
WScript.Quit();
/ l( Y5 [5 K% n}
9 K6 M6 b- n3 G% Y0 ? 2 t; }) j- Q9 T" O
try
% Z* O) k' I# P1 n6 O e/ y" @{
_; R( O( U' T7 _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& F% U0 e s9 s& g/ }/ H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 A& R% j" B& P$ C' W& }$ v if (r == vbCancel)
! y& m0 ?+ Y2 R$ y4 p, a { 3 w( W0 U+ w. r5 b7 i* V
simple.CloseModel();
2 Q1 `" g' o3 t6 B3 Y WScript.Quit();
* C7 Q5 D9 n) X3 | } " ?7 J' p7 z9 J7 r( F. v( E) ]
}
% c2 C8 G6 ~" q
, ]: Y0 K u( X1 F- }simple.StartSimulation(".Models.Frame.EventController");
u8 H4 B6 b5 M$ N
" m% |4 x& m! iif (simple.IsSimulationRunning()) ) @4 T, K! Z4 O3 p' f7 e
WScript.Echo("Simulation is running!");
& r( c9 k+ c' P' Z9 b 1 `' B" u7 ?; {" W
// Wait until simulation is finished ' ~# l+ a1 J0 {: g9 a8 S
while (!Finished) WScript.Sleep(2000);
. H1 {( S! S* L7 p2 F' X
$ e7 w. o' V! L1 |2 Y- |% Y% M' psimple.CloseModel();
r$ ]8 j% v8 w7 |simple.Quit();
' n8 n0 L0 P' b _$ o& i- oWScript.Quit(); S+ h, z$ y- D0 u
. L0 z' s) j7 D5 C: Y
% b' A6 Q: s) q- ffunction RemoteControl_SimulationFinished() 5 r, A }$ V" O
{ " E6 ^! J1 |3 x) `8 t$ z, B
WScript.Echo("Simulation Finished!"); |