Example of a JScript
V; |3 P- v4 K- N1 mvar vbOKCancel = 1;
6 A. n. v0 n# svar vbCancel = 2; 4 {! I9 m5 i9 G
var vbInformation = 64; 5 h' g5 U! u% [8 B! [7 b
var Finished=false; 0 B" S( T/ l9 Z! _
5 B+ k% H8 h/ k: x ^var WSHShell = new ActiveXObject("WScript.Shell"); + A, [2 ^7 ] o! w
6 I5 Q- b2 H9 |, {5 X( g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % m- j, l* V9 Z0 d k* s# j
! K3 P; b1 E1 V& u' |
simple.SetLicenseType("Runtime");
. B3 {$ h6 C5 t+ n, t+ G4 K " T1 s( h! P8 h6 c
try
2 f0 x1 x, _6 M$ s# E{ 1 y4 Z5 e& E. b7 Y8 }. ?
// Enter the path to a model file! 5 X% T3 R1 i# V9 E! C
simple.LoadModel("C:\\Models\\Test.spp"); # Z$ A+ h; [- c3 K
}
* |/ |1 c1 o/ A' |3 \catch (e)
4 n( e# j2 u: a" {" V6 G{
i) \; z$ G/ e7 M+ T2 H WScript.Echo("Could not load Model!");
2 A5 q* M! ^9 ^2 G4 v( h WScript.Quit();
" }" o; m. X# _6 @2 W( U}
: e. w. |: ]3 b: Q" C( K' U) c# t
5 R3 F3 `, Z* q2 g. L1 e9 B7 A6 Stry
) w' ]3 V3 @: }{ 2 x7 O. Y+ y. m' O- u6 V( J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 `) G( c/ _( h. S N7 q8 q7 z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' r* q. ^ b9 K. u
if (r == vbCancel) ; s$ T' ?0 A- }
{ % X& `! s% a$ x" A
simple.CloseModel(); * o1 x* _) p- b( Z
WScript.Quit(); / M# y+ @+ E( ~, F$ l3 U
} 0 O. t& L* L3 ~; P
} , A& W8 V; d" r, x
4 f% U: H" s( |) k4 H7 e+ esimple.StartSimulation(".Models.Frame.EventController"); 7 o- [" {" T# `. z+ |: F9 U) w, p
) _/ n) u2 O: _. a( Mif (simple.IsSimulationRunning())
4 x. H/ M9 d! Q4 c& ` WScript.Echo("Simulation is running!"); , A) w" l& w7 g% D
1 J0 b' ] i& E
// Wait until simulation is finished 0 S! s; M# j6 Z+ Z6 f9 w# X
while (!Finished) WScript.Sleep(2000);
3 K0 S+ T; O) s3 q, Y9 j. m6 y
5 a* c: x; x; A5 X3 ?: esimple.CloseModel();
# T# x, Y/ m. q3 g" K6 Tsimple.Quit(); 6 U% Q+ Y) j5 f. |1 m
WScript.Quit(); 8 U# t3 ^ C. j% S' Y; G
1 _! D! w w' I+ R1 b7 A
8 ?/ t8 i/ Y9 j% Q4 v- vfunction RemoteControl_SimulationFinished() % \4 M S3 _. e% V3 e
{
# K4 c. [. h; I* | WScript.Echo("Simulation Finished!"); |