Example of a JScript
& [! Y/ [8 z( O& u. q8 `var vbOKCancel = 1; 8 U% W( c7 H( r2 A$ |" F, h
var vbCancel = 2;
; ^0 b2 i* s( Avar vbInformation = 64;
. y8 \0 X! j# lvar Finished=false;
' |1 o5 ?, `! t 5 t( Z( {$ d- J' v
var WSHShell = new ActiveXObject("WScript.Shell"); * I" v1 F, |9 ~. @* }
4 Q; p, D& d5 i, G% t! o& d' j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & x8 T4 m1 A A4 r; `6 e% O; @, ?
$ K: I+ Q5 y' }* D% H' j; @, tsimple.SetLicenseType("Runtime");
) \7 b& X* `$ s2 D/ M5 k& l' n
i' C3 M' V9 K( `3 s0 B: Ftry
; K% q6 x `9 m! e6 `- w( O{
+ S; n# X6 b8 e# ~& k) F7 \ // Enter the path to a model file!
) }' W$ x* ]3 X simple.LoadModel("C:\\Models\\Test.spp"); 2 O- `$ C* ^/ |/ @8 \4 s
} 8 d3 w; @4 U u
catch (e)
! M2 q: y2 i$ _/ o9 X{
; _" Z5 ]. ~! ]" [2 J/ ~ WScript.Echo("Could not load Model!"); 5 ~3 J0 b5 e9 I8 h: J5 k; ]( X
WScript.Quit();
: Y4 }5 t& i& g} 7 y* n% U; F, j! S( ~! e: g
& d/ N0 L# J% m/ S" b a! J# etry 6 g6 G, _* ]" V* Y
{
0 O2 f& N* w, c' X5 W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # O* m- X* z( h! c, b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , B% b7 z. z/ T( o$ }
if (r == vbCancel) ) q I9 G5 x9 ~
{ ^0 A, }5 i0 c% [
simple.CloseModel();
! ~- r. G7 n5 w3 h- F% @4 P/ W- H WScript.Quit();
& u3 Y' g0 j' T; s5 f; V" B4 B ?/ D6 o }
. r0 p% W4 n _' U% Q$ `}
~7 j9 F( R6 }( H" k1 b
, t3 U0 m, d- y9 wsimple.StartSimulation(".Models.Frame.EventController"); . ~3 O! T/ J3 C$ C7 K& ]4 l% I! d/ @6 m
' g9 N+ j6 f0 _# d. R0 N" P! }if (simple.IsSimulationRunning()) ' i) y1 e @: Q3 N$ ]6 d' J4 ?
WScript.Echo("Simulation is running!");
7 z/ Q/ o2 R* ?4 Z- } 1 F8 G6 h9 k5 C
// Wait until simulation is finished ' |8 k2 G$ @2 v) V) @7 b
while (!Finished) WScript.Sleep(2000);
. ~ Z$ O7 ^, [ d& \/ S 9 w, g. m% ]9 E" c( K4 t( r
simple.CloseModel();
+ b% P' }& y# @1 Y8 \" Nsimple.Quit();
+ I- n9 k' O( h- E% pWScript.Quit(); 3 |: t/ A f9 Y5 t+ L; _( S
2 K5 V9 D% [! _. f- o: ?& F
* {$ b# P- |+ x; @$ w8 [9 Gfunction RemoteControl_SimulationFinished() 7 W3 T' u5 v3 b& o
{
; F* @: J! l( O8 O0 x9 }' f WScript.Echo("Simulation Finished!"); |