Example of a JScript
; D5 k3 e: X9 {9 A3 ^$ Mvar vbOKCancel = 1;
$ @& a( s3 f7 Evar vbCancel = 2; 5 I3 n5 s8 ^8 P. M
var vbInformation = 64;
( e( o1 w i: @/ w- C. ]var Finished=false;
! j/ {. C; F! t- ~3 }% R7 F1 N6 Y
9 v* f: M3 m/ W# I- x- V! [var WSHShell = new ActiveXObject("WScript.Shell"); $ a8 s' h1 }3 q3 k% G0 F
7 s) }4 e' c9 `; g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 a r6 L, X5 V
, _7 q3 u$ n( V# O3 z
simple.SetLicenseType("Runtime");
- P6 J. u1 A; A& M- L/ @
9 \& C1 p l/ v+ s# n3 itry # ^5 k4 @" f, U+ z7 }# ]& u
{
5 ]% @1 T1 f* X // Enter the path to a model file! & p# [& ~$ u& O5 k6 c
simple.LoadModel("C:\\Models\\Test.spp"); 7 S1 ^9 _; e5 R# h
} # b1 s7 V4 C6 V3 F- _' _, w
catch (e) ; B9 b# s. V% z$ G$ a8 A) q/ w3 ?8 x
{
q$ O5 F( @+ Y6 D, ^+ H, O4 ? WScript.Echo("Could not load Model!");
, n" \' t- R( @- Q WScript.Quit();
6 y; Z! Z8 q; ]}
. E! w0 Y+ u1 [5 n7 i/ _ 6 B8 n# v5 W; k6 j, D3 E6 j2 t: {* u
try
1 A* L3 z) R( y8 w% n6 F- H{
! V3 d. ^' X* J8 e% M m) @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 k, l! _* x/ c% q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! K/ [! [% _5 j. I if (r == vbCancel)
2 P" g o, Z' @7 z: q/ V {
9 Q; y! y/ j9 K: Q simple.CloseModel();
) G# \; }3 T0 P WScript.Quit(); 3 l. i( ?* v/ s2 Z5 y6 `' k4 P
}
. f0 p( k l# |+ g} 8 x. g& G6 ^" G( a" W) D
/ r- ~# |% |% z4 F8 g; S z
simple.StartSimulation(".Models.Frame.EventController");
- l$ z: o R' T# |0 p. D0 C 2 @! {7 `8 K8 r! N4 U, x
if (simple.IsSimulationRunning()) : r2 C$ X/ Y! k: M7 Z3 ^0 h
WScript.Echo("Simulation is running!");
- ~/ ?2 ^ n( ?4 ^5 ]$ u4 n ' k- {9 O* I9 m1 h
// Wait until simulation is finished " H' l$ {0 ]4 x K3 L
while (!Finished) WScript.Sleep(2000);
- g3 v4 f* r( M) E6 ~5 ` 8 h/ [/ S. V( g3 y, g6 s' f
simple.CloseModel();
7 @+ j0 Z" U ~: Z* Usimple.Quit();
9 g0 S" V+ i7 z/ k, f* V5 V8 EWScript.Quit(); " K& J# J! @' M* \) Q
2 `5 _, A: K7 U. i7 b
! g4 ~, J; U$ `3 @+ afunction RemoteControl_SimulationFinished()
& x+ F# n- P. j{ - C* c. T$ {( L& S2 V* h/ m4 L
WScript.Echo("Simulation Finished!"); |