Example of a JScript & _' ~; H# @0 D$ w: ^, w8 x
var vbOKCancel = 1; 4 O6 J* e' P, N
var vbCancel = 2; 5 S, }/ p# W6 V
var vbInformation = 64; 7 [" H7 U' r" O0 f X% l0 Q. u6 F
var Finished=false; $ w- ^% W3 }3 M" k7 a& p6 ^ @* Y
8 H1 }1 e c1 X( ?- r
var WSHShell = new ActiveXObject("WScript.Shell"); 3 F8 ?9 c6 w# ?- ]' Z- g
8 j! w7 i+ E: W1 E9 C& V7 |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ V$ s8 ~) e7 b4 A Y) ?) m, b1 A' J
simple.SetLicenseType("Runtime");
$ f7 J& j, f. S- x 6 F! `" c. Q5 ^4 b
try 2 h+ z; m7 ~/ j% x% k+ S
{
" b/ H9 U% O+ n6 v" o // Enter the path to a model file! - l w: R) W. Y
simple.LoadModel("C:\\Models\\Test.spp"); : \7 y! Z% j# @/ I) q+ N
} ^' B/ l i- i1 L
catch (e)
) o' V# Q; M. \8 {2 h% w& |{
! |1 T9 v% C) E3 y2 o WScript.Echo("Could not load Model!"); " { C: e; M$ b: l) m8 g. j6 [3 n
WScript.Quit();
/ z5 X# o( Y! q* J' q}
; Q6 p5 Y: d; ^* r
; \( ]1 ~! M1 P$ x- G8 r, Ptry
( o! {0 h3 g* \3 V$ W" L{
4 I: `7 y. u5 U4 ?/ P- f1 d0 { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( N5 ~3 x9 \1 S r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & @( _. x$ Y' N: Q5 E4 ^
if (r == vbCancel) * N5 ~& [' |& t
{
3 v1 g: b' P/ I: I% h8 x; x simple.CloseModel(); 1 y6 ?- T. P L$ Y! S
WScript.Quit();
4 d3 @/ ?) L' T5 c: \ p2 A } ! k Y# O6 x" j/ g
}
" ] z3 u& @% F & ]+ n' L2 }* k1 p) n0 o
simple.StartSimulation(".Models.Frame.EventController"); * L& C4 }0 ~3 c5 \
$ C0 T' l- t0 o2 \if (simple.IsSimulationRunning())
$ Z m; c$ R* y. n6 J WScript.Echo("Simulation is running!");
8 Y/ f! T* P3 ? * g/ `$ H& O. t7 B
// Wait until simulation is finished . c. ^ _2 U# R9 j8 {5 R5 ]
while (!Finished) WScript.Sleep(2000); 6 m, P- N b% J4 g4 `
4 g4 J$ P' r O6 ]3 o0 N
simple.CloseModel(); 1 w: _, m/ x- E- ~0 @9 p8 Z
simple.Quit(); ! d$ h7 f7 v8 H/ l3 q$ @) N p
WScript.Quit();
( ~" u; E l7 T& k3 `6 s- k
) f P/ C! |3 B f
8 b3 a* `' {& y! H* K9 c0 efunction RemoteControl_SimulationFinished() % H. r$ J" e* x t: j
{ 7 P6 A, o h. T
WScript.Echo("Simulation Finished!"); |