Example of a JScript
* Q v8 v0 C; |3 s5 D( Tvar vbOKCancel = 1; ' F& P M6 `& B0 ?
var vbCancel = 2;
$ P P6 q: P G1 H k* rvar vbInformation = 64; & x2 v D4 |: A# T0 M
var Finished=false;
) j, V' p* V: ~. u# C4 L6 k 7 g/ z9 A4 m9 x0 k# C' _: ~* q& R
var WSHShell = new ActiveXObject("WScript.Shell"); # e r5 O! b7 e' N% `
5 N0 h2 n3 l; E- ~1 \7 @: A5 Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% j; t3 P/ P6 U6 U L5 w; j; a0 h
& b2 i" c: b' c u( ysimple.SetLicenseType("Runtime"); ' T$ {/ L, `+ x7 h3 ]' o
" m1 X1 |: i3 rtry # z W% X, Z# d2 C$ ~2 y+ }' L: y; f
{ & e/ c5 e' Z6 _6 h0 a5 \; a
// Enter the path to a model file! 6 p4 i" {! S& r+ u: Q+ x; T; l
simple.LoadModel("C:\\Models\\Test.spp");
9 K) U, q' }6 Q; E9 n5 y; x3 f( f) i} # F& J/ e1 H! \; f% N2 H
catch (e) $ y) w [4 s& d( M: J
{
! w5 [0 r" U) Q* [ WScript.Echo("Could not load Model!"); 4 C. n' d. L/ l! S+ r
WScript.Quit(); ! _/ g) t3 @. c" e" y
} |5 p7 E) Z5 ?8 Y* h* a* |% _
/ {6 U9 A: |$ Z: Q2 z/ C5 h
try
8 y0 I1 |: q* D$ G8 G2 {/ C{
+ v- x4 {; z% Y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / H y0 E8 u- a; Q: [$ b, u; W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 y2 g2 |. a% c2 c4 }" C! e% j if (r == vbCancel)
" s' `, a3 O% E! N& a { % z, |; f) j: P
simple.CloseModel();
, ?7 o/ W) P( F; i, |4 l3 d WScript.Quit(); 1 g" J8 P- }- Y+ ]$ P- s' R
} : u h6 S, T& A' P. ~
}
( I- P S$ K$ K- i; ] # O+ J: f, ~ X" n3 z
simple.StartSimulation(".Models.Frame.EventController");
) c. f5 N/ A4 P2 a2 j . z2 G0 W% N6 a
if (simple.IsSimulationRunning())
5 U6 C4 F- ^* m+ V" z: K WScript.Echo("Simulation is running!"); : T( J% D/ A4 f4 @3 ^) f
9 B) E. `! U6 `, E- _; R
// Wait until simulation is finished / u5 Y- B7 i/ F$ [
while (!Finished) WScript.Sleep(2000); 4 }4 M+ X2 ~' F
& @9 c2 \" W+ W, _* ?( I. H
simple.CloseModel(); - i! S- l' G# J
simple.Quit();
+ T9 E5 N8 l/ H( M7 mWScript.Quit();
1 ]4 S7 Q j5 j# f7 d) T: v' i * x5 F9 h2 g# X; v
& z. [" X' ]5 z) hfunction RemoteControl_SimulationFinished()
. k* B, U4 b: |* v4 f! i6 E{
3 g" X0 `; k2 R' R3 s" Z WScript.Echo("Simulation Finished!"); |