Example of a JScript
7 S5 ]0 v& H0 t' a" wvar vbOKCancel = 1; * o z" @1 @) k: {8 h
var vbCancel = 2; + v3 c- P4 a' x6 s) v" a
var vbInformation = 64;
. ~: i# Y6 a8 d' A! _0 o$ evar Finished=false;
! E7 H/ J) B5 V; @) M! Z% w 2 y* c9 {$ I, |/ A6 b' Q
var WSHShell = new ActiveXObject("WScript.Shell"); 1 a" ]3 i% h$ P& X0 o$ P
; V2 Y9 a' j3 k5 cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; G: r& l- M1 |' p) \* f, S 5 i# R8 q7 ` y) {- p! b9 ^! J. w
simple.SetLicenseType("Runtime"); ) ^9 h: j; I. U( W6 b1 T% Z
0 G, f/ f3 k( W2 H5 Gtry . j+ m; I8 a/ e
{
0 N9 K8 C2 O" x [ // Enter the path to a model file!
8 ~- v0 K) H% j' U7 L simple.LoadModel("C:\\Models\\Test.spp");
6 V8 E1 {. F4 ^ @4 H& G} 9 Y% V8 F0 S0 U! t
catch (e)
$ [ H5 g( x/ r1 |{ 6 [4 m7 u- j0 A* f$ n( K
WScript.Echo("Could not load Model!");
, ]7 z4 `" Z1 k2 A WScript.Quit(); 2 @- w1 y1 Z2 N8 H
}
8 ` f: w7 ^) p8 b, t4 x* b 5 V* z r% L) g- o9 j
try ; R4 B/ G5 i4 R- ~! w0 b
{
4 S6 `( ^ o' f: j# G simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) J& A6 F# z" a1 o2 {/ z ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & h' J4 }1 y. j9 h
if (r == vbCancel)
5 k) t- C$ K; N( V { . O2 c1 E8 q9 N8 c
simple.CloseModel(); ( c9 K8 @3 E: x- A/ ?
WScript.Quit(); 5 d6 B7 \/ Q0 ] w
}
4 c5 }+ n1 y x% }} , B* T( v, @: F; D
. p( M0 q/ G% j; ?/ Asimple.StartSimulation(".Models.Frame.EventController"); ; E' V% a7 U+ w6 K2 ^4 I8 p
5 W+ t! Z. B% h. Pif (simple.IsSimulationRunning())
: q# o% C" n, b! \ WScript.Echo("Simulation is running!");
# Q% T& G) E5 @9 T$ X . p6 R( K( U1 h" f
// Wait until simulation is finished ; Y; D9 v% a* x/ |8 H
while (!Finished) WScript.Sleep(2000); 4 F2 J, V( U; p* g9 L: q, W- w
5 K+ y5 b w4 c# t6 a: Q8 b7 Y
simple.CloseModel(); 4 E, }- [$ S7 y$ F* k# w
simple.Quit(); ( g% [" V2 \6 g2 W9 z
WScript.Quit();
) T: `" C5 B' X1 z$ {( z. t9 s
6 u- A2 F/ S0 N! K$ v( o # b3 @, o. z" P [/ {5 Q
function RemoteControl_SimulationFinished() ; h) K; {: T" K1 U2 j& G$ k& R. S
{ * `/ D) S4 P1 M9 _6 o
WScript.Echo("Simulation Finished!"); |