Example of a JScript 4 v+ D6 f5 [& f
var vbOKCancel = 1;
, p; N' i7 d1 ?' U+ P0 ~var vbCancel = 2; 1 }9 M% w ]8 }3 ~, n
var vbInformation = 64; : n0 O# S% q4 y1 e) T) t
var Finished=false;
3 j. ?* J A& r2 O$ Q
0 C2 L8 _; k$ B0 I2 e+ m( V' X' p: evar WSHShell = new ActiveXObject("WScript.Shell"); * T5 J5 a5 @& v
+ v2 _# \6 h! d* q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " e! t. H8 |% P; k
$ t* c5 u8 I5 q7 usimple.SetLicenseType("Runtime");
1 }( u4 r' h; D% B) c & [8 T) B9 Y! I- ~
try 9 \" z8 y6 ~- D; [, C0 b+ V
{ & i6 C% m% b% A) ]& D- m4 t
// Enter the path to a model file!
4 \1 x* @+ m) E2 @+ e0 `# `& ^1 | simple.LoadModel("C:\\Models\\Test.spp"); : L: `0 F& K) V! h. e( \
} O- i/ I {2 g/ ~) W, ~$ P6 e
catch (e) 5 g$ W6 K% h3 Q; V5 x+ J
{
2 B# G; Z8 g, @- N: W WScript.Echo("Could not load Model!"); + w" x* i/ F( b) }4 S" }8 y
WScript.Quit();
: q' R3 `4 G3 E( @}
$ J+ \5 g: v: o. A; W* J1 F 1 r. V9 a# M# T ?7 a+ K
try
2 h. |4 A9 O' o6 e: P2 _( U{
) O5 d8 S X' a simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 Y3 p' l+ `+ P+ l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% p4 v3 C# J7 s) N, Q if (r == vbCancel) 4 {- r5 N8 t0 Q/ H
{ + e2 {4 w) J6 {/ l" [$ o& s
simple.CloseModel(); & f/ J* r8 D* p$ X
WScript.Quit(); ! d7 B G* M) q0 J. n% u
} " Q/ n5 ]" @7 Z
}
/ t2 ` A3 n9 z- i) q 2 \# s6 q* d, S( `- g
simple.StartSimulation(".Models.Frame.EventController");
) Y; r; b3 U' O- @+ P$ @3 D5 B ' F1 `6 }6 j1 g: E
if (simple.IsSimulationRunning())
1 J# C# Y' V- h+ ]7 N! G" f& ? WScript.Echo("Simulation is running!");
/ _7 e }0 h# L' T' i1 ~ # @3 u* H7 C$ j- `' C! p& q
// Wait until simulation is finished
$ J% T3 H$ F0 |* Pwhile (!Finished) WScript.Sleep(2000); & x2 @) a; E: o& G
7 G3 b% Y9 \; I, z* J! Z
simple.CloseModel();
- N# c9 P4 @1 X& h1 v# b& H5 R" Isimple.Quit();
2 A0 @% f4 G* {WScript.Quit(); 0 T; ~ w! _7 f/ l; X% u' B
1 ~9 a" ~1 |, Y6 V7 U' a% Y- j; `
6 p# i; u" O4 I7 L8 ]function RemoteControl_SimulationFinished() . R% J) U/ N( O
{
& B, B0 ]2 B' M WScript.Echo("Simulation Finished!"); |