Example of a JScript ! u9 j# M, _* r. h3 G
var vbOKCancel = 1; ' C) c) ~& ?0 Q7 u+ q4 r4 d
var vbCancel = 2; 8 a% g8 g9 Q' x
var vbInformation = 64;
' V0 s1 V5 P7 q- Y5 C8 u! _: p0 c0 Evar Finished=false; ( d9 G2 P9 w! w6 R+ L
5 b- G' z9 i7 j# r! |6 ?6 ~
var WSHShell = new ActiveXObject("WScript.Shell");
# S* K: O1 x' \5 h; K( G ) S) p3 p3 }4 ]% g' z) }3 `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , s9 U. X4 b9 {1 O
4 D/ A& S+ V$ a3 S3 W* ^8 A2 m% R- Y
simple.SetLicenseType("Runtime");
' \9 x1 }. s1 A' G5 \ 0 L* C( k, J0 Q
try 6 M) S2 F# v& ^8 n+ O m
{ 9 T, c# }9 q2 g4 A$ q& S
// Enter the path to a model file! 1 e! Q4 b- i: O4 ~6 c0 |! Z
simple.LoadModel("C:\\Models\\Test.spp"); , Z2 g4 b ]9 y" x1 l6 W
} 4 O2 }- `6 Z2 B) k! H
catch (e)
4 X, i0 `" C: a+ u# f8 N( @{ % g! y* y$ K, ?' F( j
WScript.Echo("Could not load Model!"); ! V6 x. U8 B9 A* G# V, @
WScript.Quit(); * k( M8 b' y! e
} ) L" m$ t$ O0 z% v4 L3 p
+ I* d* [0 O& M& \: b, Xtry ) u9 C _- g( a, H! d5 E" J4 ]
{ 3 o$ g2 o9 q, F" m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 z4 y: n! H1 W7 |8 r0 ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); \8 X: I% @- U! [
if (r == vbCancel) / d1 h( M7 ` G& H- u8 H
{
* F; n* J, p. ^7 y' b simple.CloseModel();
' w+ a9 d! ]- v6 _' d( J( s, C WScript.Quit(); % ?/ B( t: Z7 M7 @6 e
}
, y/ ^. d' F7 v: h4 b* y& ^6 D a& W1 Z}
6 S3 Q* x7 V5 d I W/ @2 f . f0 g+ Q+ f9 R1 d3 D
simple.StartSimulation(".Models.Frame.EventController"); " e. Y$ I2 H. X8 K
) r5 p8 w# O. O7 t7 F# R8 l' H
if (simple.IsSimulationRunning())
+ v) N/ Z& ^5 [8 U6 r" i, t/ w WScript.Echo("Simulation is running!");
0 l5 Y; S( \; Q' ^9 i9 M! P8 F' M' k
1 d2 h) p/ F6 T7 l5 z4 U// Wait until simulation is finished
' F( B% C! m8 [while (!Finished) WScript.Sleep(2000);
( }7 o2 P" ]& U- [% ]
, l$ W5 Q1 k2 U e( M+ U5 a% fsimple.CloseModel(); - C9 G! i7 w5 ]" R3 ?# X, ]
simple.Quit(); 9 ~1 R) c4 G1 P! v! ?
WScript.Quit();
( W! D# r& w6 t, S
3 C2 r- c9 y' B* g& N- T& m$ [4 x
" {+ p* p9 ?. G7 ?& m! ifunction RemoteControl_SimulationFinished()
1 g# L+ T4 D: w2 Y$ Q. }& u{ 0 g" X# S4 s, \& f' d" j0 M
WScript.Echo("Simulation Finished!"); |