Example of a JScript ; }1 a& _2 I+ O% R) `. p
var vbOKCancel = 1; ; ]$ P" p5 G2 `1 z/ S* O
var vbCancel = 2; % q+ Z$ |0 y" D' w* P2 z
var vbInformation = 64; 1 @" j8 P. @) `- @2 y- y
var Finished=false; + l, q$ Q* I/ Q5 j6 `0 q
. r: d9 k+ s: U' o
var WSHShell = new ActiveXObject("WScript.Shell"); 1 b2 V! M* ?2 ]% l# _ o
# O3 r+ \2 ]2 y& k; T6 Q- \( h5 K
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) r" ^. i0 g3 E0 }& D3 _9 A
8 \$ }/ X" E$ V
simple.SetLicenseType("Runtime"); 2 @* ^0 p. i0 h
9 f4 g: g a, F' E/ I, F
try
- [' l0 e# z7 O" r" R. U{ # B" q1 j: e! X' X* D: [
// Enter the path to a model file! 6 b8 ?* w+ P0 O/ D( R
simple.LoadModel("C:\\Models\\Test.spp");
" O( ^: Q* k' A" k}
( q8 a, n% E/ p/ scatch (e) ' ], t7 J" `- h# I: q$ ^+ _: B
{ 3 J0 h% B n" S6 I" |$ `( @, F# a
WScript.Echo("Could not load Model!"); * l2 ?9 x$ w+ |3 ?
WScript.Quit(); ( r7 m9 K9 V' \, z; k! m& ~' F
} : I* Z P9 P+ r0 M7 B5 J7 {2 `% z% V
2 i8 F. p) G L& V: [( y6 o
try
) P1 F1 D( |& @% K. W+ f1 J{
2 z' f, s! B& a5 H% B: N9 b simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - ~& [: h- l) ~- n7 D/ ?7 l4 M
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 _9 o+ O6 ~. e* P2 l if (r == vbCancel)
' ]. @! D% k! Y. S, @ { , L2 a! f1 g0 n
simple.CloseModel();
) P6 A1 K) O1 S% n WScript.Quit();
- E8 f' N& `0 H( o } 1 ^; K D. N9 y
} 5 j. V" l5 O- k( j; z7 M
6 L; K2 z, k( O, Ysimple.StartSimulation(".Models.Frame.EventController");
. @: J, F5 c6 `7 m* O 2 K d; t& F w) L
if (simple.IsSimulationRunning())
: v2 Z5 c" ~, I/ }" F: ]- \% S WScript.Echo("Simulation is running!");
& y A( } X( b- b" R+ R & H4 k9 C) h: V# i
// Wait until simulation is finished
7 ]7 Q, |- C+ |7 A4 V: t+ Ewhile (!Finished) WScript.Sleep(2000); ( D) H$ v0 S; s
) H$ [5 O; ^( ?5 |" _7 _) m3 x
simple.CloseModel(); : v; e7 O, |9 }$ t6 Z. w0 t& Q
simple.Quit();
( s) `! R; K1 i# W: yWScript.Quit();
( P" f/ A6 D1 w
J3 } K8 [' A6 v * l; w; c5 h+ a9 V. X/ a+ U
function RemoteControl_SimulationFinished() , I* X/ i' H2 _" ^0 F n! n
{
/ U- @$ [4 u' s% K" ~ WScript.Echo("Simulation Finished!"); |