Example of a JScript
& e! i& }" G( evar vbOKCancel = 1;
6 {5 h2 v/ z2 @var vbCancel = 2; " w0 J; T5 V- d. q" g4 D
var vbInformation = 64; - c, x1 C( Y; E- w$ I
var Finished=false; + |0 c# ^+ ?3 d9 E8 l2 `+ K. ~9 x
2 T' T. @4 P4 G4 w$ r
var WSHShell = new ActiveXObject("WScript.Shell"); $ s% E* o y9 w* D, a8 E
7 X# i9 T: f; a6 R0 x F0 Z( u5 L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# h9 l% x/ l0 ?" T: ^
; e/ b$ o2 b- h. nsimple.SetLicenseType("Runtime");
D+ `- p: l4 N8 t+ V: a
- w4 c# U E) W, Vtry - Y B3 |/ ?5 O* X$ ~5 D# `
{
. f% H4 |& h3 Z9 R ^3 s( J5 Z- C4 z // Enter the path to a model file!
2 F) c- O9 O" J. W9 z' |: v, W simple.LoadModel("C:\\Models\\Test.spp");
9 D3 G, ^5 ~7 ?& d+ S2 c}
T& U" B7 j( T* {/ c" Ncatch (e)
' b, K( ^6 q: j8 Y' j6 k: R7 V# B{
^; u4 W! G1 {9 M. v# }$ V. v WScript.Echo("Could not load Model!");
. w2 W: ?( d/ m8 l, y' `7 E WScript.Quit(); 2 A8 T* V. T, c P1 q* C
} , G& z+ f7 Q* ^& l6 I( B- |
. W8 v O7 D$ I- ^6 Ntry
" F" w6 D8 w4 x9 k% n{ 6 V" U6 X3 y4 k. f: w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 q( a9 R: f% ?5 i5 k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; X* c0 R: f+ ?" k9 T w2 Y; `" g if (r == vbCancel)
6 \% c' d; X0 G/ k {
' T! _" v" [# F7 p simple.CloseModel();
+ D2 s+ E: [1 @& ~/ w' b- V/ } WScript.Quit();
S& N8 u( g( q$ q } 8 y( R: K. k- L- s# r$ q# }
} : X [- |* q1 F4 G7 f) J' U
1 m# v4 V; e3 O- ` E
simple.StartSimulation(".Models.Frame.EventController"); q# s5 ?4 f f6 g, \
- ^# R, y6 H( ]4 p! G
if (simple.IsSimulationRunning())
+ B$ d# P+ B1 Y, G7 Q7 e WScript.Echo("Simulation is running!"); 7 B& q1 x( \/ Z: u( }) L
+ r7 x9 N; e3 R' W' k5 R
// Wait until simulation is finished 8 Q* w; G1 l) ~: U# z9 C3 N9 H
while (!Finished) WScript.Sleep(2000); 8 K8 q Y0 |' r( d& G3 R+ H- M& D
* g* i/ n+ C7 k! j: X) y
simple.CloseModel();
& n* p V l+ Z- c9 @9 `: Ssimple.Quit();
5 B E# ~% M4 V% TWScript.Quit();
' |: ^/ D4 u, R, x$ W4 R
$ J8 z% n2 n7 S( a$ v4 U F& j / Y; l# s6 m: I Z |: i
function RemoteControl_SimulationFinished()
: e* v3 L, ]( D) N" \{ ; W. e" x) X6 R' _
WScript.Echo("Simulation Finished!"); |