Example of a JScript
* z c+ t0 z y4 t- \! Wvar vbOKCancel = 1; * P/ [: g4 G$ c
var vbCancel = 2; $ n% A+ ]5 Q& b7 I2 u
var vbInformation = 64;
: o. k. `6 N% }% Zvar Finished=false; , [$ f4 a ^( \* ~
+ U+ c3 C s1 }1 r( d* R, F
var WSHShell = new ActiveXObject("WScript.Shell");
: Z6 W% j0 T7 o5 _# q1 u' p l
0 I0 b: k4 A( g- qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 P) ?# S j6 \0 q9 Z5 K
' h7 y) ~$ |$ Hsimple.SetLicenseType("Runtime");
" L8 f+ Y: U# x& F+ `
6 \& r4 @; V8 x( Vtry
: A$ t0 E6 ^# |% k' P{
4 t1 [: w. A! t1 j // Enter the path to a model file! & ?6 D7 U; {1 D% B' o5 j+ R
simple.LoadModel("C:\\Models\\Test.spp");
; n6 f. l4 D+ T8 j3 q" c" H9 f}
o( d# t5 l9 E. \. U3 Ocatch (e)
9 P9 c( V! r" u/ y+ k% i$ t& e{ & S& l9 w2 [" |; q
WScript.Echo("Could not load Model!"); 4 [4 h# u9 g6 E6 |
WScript.Quit(); ; F& `4 a4 @; a N3 H. P
} + q# U( ^3 s u
4 A+ I% e! I7 S3 U9 V' q1 ^; p$ G
try ]5 |7 V3 \ S. Y0 t% x
{
6 l7 z8 j, k- W4 }# l# ]) x g& ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 ?: e$ b1 k+ q0 [( L: \
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * y P. P3 d) b
if (r == vbCancel) + R' g- q) ^ J& Z8 f; b
{ : Z8 T- `' W) z4 x2 I9 K
simple.CloseModel(); 7 {9 _# ?+ H$ w, K/ O6 N' `1 M
WScript.Quit();
/ D$ c' D) C/ g9 A }
- _) k8 `" m6 f- C% A} ! K0 V) k0 y/ @% o _* a
9 f0 s8 Y. _7 w/ b& asimple.StartSimulation(".Models.Frame.EventController"); & L8 M. L% K$ G6 ?- s- u" S" f
' \! D# A' p& m; x
if (simple.IsSimulationRunning())
1 g$ ]9 j3 z" M! `* e* C WScript.Echo("Simulation is running!");
$ L0 E; m1 ?, t$ _5 @& D1 j5 L) F : Q4 c- H% X- m) X: t' N* @
// Wait until simulation is finished ) C# ?7 m; [' k, i
while (!Finished) WScript.Sleep(2000); 5 A: a. i p6 l3 g6 `( B
! t- u1 T& ^ V: w+ u
simple.CloseModel();
4 c! h+ z# L8 F( _3 Csimple.Quit();
6 a" Q C7 D; i2 O! y4 M1 _* I8 NWScript.Quit();
, P& p, P A8 s1 ^# N/ G! k4 E 1 q' d* l6 \, Y1 X
2 O4 i# {; P+ U b% S) e& K! h* Q7 tfunction RemoteControl_SimulationFinished() ' ]/ X& j: @# ?+ k3 M4 {
{
8 Q7 Q" K( I: G, A9 Z WScript.Echo("Simulation Finished!"); |