Example of a JScript - ]! a( H0 q, g0 C% O3 |/ o
var vbOKCancel = 1; . {, a/ d# g. Z4 s9 Z& n
var vbCancel = 2; 0 ^& k' a4 R4 J: a) F. `
var vbInformation = 64;
' a. x, @8 }$ {var Finished=false; 7 r% L+ Q1 H1 Z( U( E; w0 ~) _
$ a+ E p% Y* A# k) W; Qvar WSHShell = new ActiveXObject("WScript.Shell");
$ ?# Y C8 ]6 Q7 X7 z 7 M% L9 Q9 {7 C) U2 t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 ^6 \4 c9 I6 M% d3 {
+ H/ R4 k3 k( v! @/ |simple.SetLicenseType("Runtime");
; F J8 q5 Z! Y+ i. J) | # b6 g% \( b: `2 O/ j q
try 6 B i y; x; b( B
{
- G- P. U2 b. R8 l // Enter the path to a model file!
% N3 x. K& U5 H simple.LoadModel("C:\\Models\\Test.spp");
2 P: t& P$ f: s5 N! Y- E' { [: O} - P& x% M R" q+ N+ K8 D
catch (e)
; @1 J3 W8 t, R d{
7 n Q/ W ]2 W WScript.Echo("Could not load Model!"); , r# m m& e* g. T3 `* u* i$ B
WScript.Quit(); 7 E; k9 k h1 k0 V, \) O
} 6 S' Y5 X! |4 Z
) ^+ ]( a0 {* y- O6 ntry
5 ?" r+ J5 E8 `; @{
5 A- ^: ?+ g; ?/ v. `$ s0 x8 |/ |- e simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 ?) g$ _3 S O% e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 x o# G; c8 G- ~' g( ]
if (r == vbCancel) + J' x/ X- g; J# a
{ . h: s9 { s( t% W. y5 M
simple.CloseModel();
1 h/ [/ i0 ?. j& \. E6 Q WScript.Quit(); - N$ B4 [) Q9 V/ S9 T6 U) s1 Q5 P
}
3 s3 U) d8 M! s$ q) E} + g9 p9 u# f+ \+ C; D7 q
& l2 N& v! E* E1 M4 F/ Qsimple.StartSimulation(".Models.Frame.EventController");
* F' {* w2 h8 C2 |/ I 3 n" A u8 u+ r0 D9 a" r; }
if (simple.IsSimulationRunning()) 6 P: T7 l" s3 p. I5 H( {" V' x
WScript.Echo("Simulation is running!"); - p: J v, M1 C) s+ s/ u- P
/ j# u" E/ g( J5 K; S* Z( g6 K// Wait until simulation is finished 8 [- t9 J- s4 R5 a! R- c
while (!Finished) WScript.Sleep(2000); . ^: [* z: ?% p3 V5 S# F) a7 {7 M8 a) N
* L# F7 D% c# T) G
simple.CloseModel();
4 C4 H' F, M8 l: P- msimple.Quit();
& q2 x' C6 K$ B4 GWScript.Quit(); 6 r$ c5 Q$ ? b1 D; _3 y+ u: x; v
/ [$ f, |/ f J. A3 _
& g, e& Y7 }% o# a, Q
function RemoteControl_SimulationFinished()
% S/ V) W% z; e, H9 d% o9 d{
: [, B4 a3 [/ s+ W6 k7 U WScript.Echo("Simulation Finished!"); |