Example of a JScript
9 y6 v+ q5 t/ x5 R- ]$ Qvar vbOKCancel = 1;
2 g4 m7 g; X; m* `; X# f+ ]var vbCancel = 2;
7 R* |( n& ~! ^6 O- G4 pvar vbInformation = 64;
5 W' c0 n r, @, A' a5 d) lvar Finished=false; ! K2 g9 G V- Y/ A5 S
( k, V( D* G6 Q4 svar WSHShell = new ActiveXObject("WScript.Shell"); # A6 t+ F# }- P5 w
' a# h) V3 p! F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) R) R. x7 F8 J+ {
, D' E) r# S. O
simple.SetLicenseType("Runtime"); ( p1 d0 p e6 [
4 r M4 B3 A d3 @
try
4 ~) V& R! p! y3 p6 j{ % x( L1 [! C4 ^ p2 p; R
// Enter the path to a model file!
& x' R% S! X. W. \) u% t simple.LoadModel("C:\\Models\\Test.spp"); 2 p. W5 k! @6 f: r# K) L
} 7 p0 M/ O% K: l9 T+ P
catch (e) , A3 u, ?+ ~. _9 B. y1 Q
{ 3 n' {7 e$ ?7 n, Z' o# }
WScript.Echo("Could not load Model!");
+ x8 I! s8 a- g9 V6 |/ ^, ~# t WScript.Quit();
# Y( o3 s9 m/ g7 {}
" H/ F U, W* {
" x( p6 Y" C" w" ntry ) s' X4 y! P% q8 a- s5 K& P
{ # c' \% ?1 T8 q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / {; D0 \% D2 V1 q( n! h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & k3 V2 ~6 r# C3 M
if (r == vbCancel) 9 ?, g: x! d) g! t/ { y: V
{
; g* I% u. O* Y$ M simple.CloseModel();
2 V# l* j# F- R WScript.Quit(); - \5 z! e* N9 [( h, {+ L. T) T
} 9 G+ G, B3 S; L- y1 f9 N, D
}
4 i7 r% w( a+ ` `* k2 { / K% R9 a0 v2 z. i
simple.StartSimulation(".Models.Frame.EventController"); . c6 Q* V& ^5 X
" g3 {; Y/ w" K7 S3 W- L- Iif (simple.IsSimulationRunning())
, r! c( C7 b% `, c- i WScript.Echo("Simulation is running!"); ( d6 G) X" ]4 Z5 l; n2 x
1 c3 e: W/ d/ D- n+ H2 v$ M- f// Wait until simulation is finished
) Q, D/ Y$ d% c- |& P2 Jwhile (!Finished) WScript.Sleep(2000);
7 Z' ^: M$ R& @ {" z+ Q+ l * j: W, C+ h, j; c
simple.CloseModel(); * {- Z! B' u5 F/ F
simple.Quit(); - W0 Z( N* E& w3 i1 C$ | k ^$ ?
WScript.Quit();
- Q7 @; j0 ~( t* L" z + m" U' i" z( H7 i. H- E
- i5 F9 w- L3 u+ _" x7 {function RemoteControl_SimulationFinished()
" {2 h; C- u9 b- X( z# Z: ~+ m- E{ 9 P+ W( p$ f8 x9 l# v( q; @! a) U
WScript.Echo("Simulation Finished!"); |