Example of a JScript
0 c0 E8 E5 @ U. G9 V4 Zvar vbOKCancel = 1; $ P4 _; j/ q7 B* H! k8 F
var vbCancel = 2; 0 X+ m L/ W5 x9 U" M+ K0 L
var vbInformation = 64; ( F; V6 U& f" U; O% N' m6 R# M0 Q
var Finished=false;
+ g$ M$ d% [5 U% c; x & K& O+ [. D) ?& e
var WSHShell = new ActiveXObject("WScript.Shell"); & a: z, C' j4 V& I; P( m* m0 H: M
% A$ J3 z& Y u o: O6 L Gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ z# G6 n- ?( |6 u E3 O1 D : x9 M( f/ T! y$ L% i
simple.SetLicenseType("Runtime"); # R7 b9 C1 e- U/ `6 f/ ^1 Q: L9 u% o
5 y6 r4 S! b) J) U
try
* v7 o: |5 ^6 n4 ?# m1 `+ S. z5 X{ 2 g u+ {+ \" \, l' I$ k2 a8 k1 I8 U
// Enter the path to a model file! 4 n) m# d" P$ n+ x2 Q8 i' }5 ^: i+ `
simple.LoadModel("C:\\Models\\Test.spp");
/ u7 {" `9 ^2 w8 f" ?7 G}
5 D/ Z' ?( _+ xcatch (e)
- e/ \9 g" B- P2 a. g6 }3 z4 x- S{ % e7 V* ? x u3 v- E' p' j$ x
WScript.Echo("Could not load Model!"); 5 S! j4 ~0 g4 v# [! l' ?3 b
WScript.Quit();
, n: {9 F& }9 q* S* L} - f* t" G V+ u: f
; p6 y: A; z! O5 b/ gtry * d( z3 d- Q& @+ \3 _. W
{
8 E4 B5 W/ p- r8 H simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: `) m9 N, X5 a- l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( P4 r w4 V7 ?9 U2 k7 N- S
if (r == vbCancel)
' o. E' K7 C) Q1 o7 _0 g { Y9 s* U! E$ m }$ E
simple.CloseModel(); * I. V/ r3 L4 r
WScript.Quit(); + N2 u0 U+ U- S1 D: s! I
}
+ |3 v( w% l# A$ v; _5 p+ m; \}
; g# s* I+ U5 @7 a: n ! u3 A4 e- ]" v* N0 `
simple.StartSimulation(".Models.Frame.EventController");
& p, }7 }& \3 h6 ^ x5 U 7 X+ h' `9 E! q1 i5 s: G
if (simple.IsSimulationRunning()) ) B4 j# P5 B! E& e
WScript.Echo("Simulation is running!");
/ ?5 ~8 V! l& x8 Q- U: K6 V" i K
- A1 h$ _2 z3 h% F5 v// Wait until simulation is finished 1 P0 r; |% J- _- [
while (!Finished) WScript.Sleep(2000);
. @, H: v& g) L- Z- _7 ~% I
4 h I2 z$ f& r/ Xsimple.CloseModel();
, C( F/ |- e0 F; L$ Nsimple.Quit(); $ L. @6 v W5 ?- t- L
WScript.Quit(); 9 X% q9 e( k* X! v [( i5 ^1 G/ o
6 z/ W$ l& U( o1 O1 o
; D5 C4 G; B- H: P- w! w
function RemoteControl_SimulationFinished()
! e2 C9 |. Y) F! N{
" Y( F% j( @) F WScript.Echo("Simulation Finished!"); |