Example of a JScript
2 T( U) v8 L4 bvar vbOKCancel = 1; 3 u% f& ^' ?$ y
var vbCancel = 2; ! k& `4 H# U4 A9 K. ~) W9 D: {
var vbInformation = 64;
0 X0 j B' G* Z) Cvar Finished=false; 6 R$ \2 i- c& j" U6 v
2 [+ ^: a: b* ~8 x; U. ^ i% ~var WSHShell = new ActiveXObject("WScript.Shell");
8 O2 X8 w k$ G- p: r
( L2 L' i4 V1 G: M" }6 hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 f( F" g" a. D
! K! P9 |4 k4 N3 M" rsimple.SetLicenseType("Runtime"); R; g* n0 v) H2 f2 B
) S) ?# Z) y+ x
try % @( D; [; n( j
{
0 p/ P1 r5 ^+ K/ Q+ _8 j1 ? // Enter the path to a model file!
" b; U7 @$ z- b7 m simple.LoadModel("C:\\Models\\Test.spp");
$ O7 P! x" g9 S}
4 p' T% k/ ?! C: D4 K; Ncatch (e) 1 P. P' ?9 ?3 k9 I
{ : R0 M, `# X2 Q/ X4 ~1 S
WScript.Echo("Could not load Model!");
# \& ~5 D% }) j# z2 Z0 `4 P/ W7 _ WScript.Quit();
9 V0 M: A3 L( a, a6 F w} ' Z) @+ e2 w( E% b
2 B- [- Y' t! q' t
try
" p# \$ c7 i9 \7 X+ |3 @{ ( N0 `8 H" i' m4 C" J9 ^8 Z& s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# a$ K8 a0 Z# ^4 @! V; J d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - g: }0 x7 h# c6 B, e
if (r == vbCancel) ) `+ m ]: ?1 K% x, w5 e
{ - o- D7 l9 `. I- B
simple.CloseModel();
) R) H' o4 c |8 G& Z) Y WScript.Quit();
1 j& D+ ?6 _) U) I$ e }
( k) d7 @. G/ D5 `& |" k}
7 o( U y6 K: H$ A
" I( n6 M, ]- c+ w+ hsimple.StartSimulation(".Models.Frame.EventController"); 4 e% a: M/ f5 [( T* l' R
0 d% U% u% E2 L
if (simple.IsSimulationRunning()) 6 h0 l; `: \& e2 s
WScript.Echo("Simulation is running!");
$ ~7 i7 E; t3 S) o$ U
/ U" L5 ]& h& j9 M& U. q! K9 ]// Wait until simulation is finished
2 `( i1 R/ ~& y W% y& u: C- bwhile (!Finished) WScript.Sleep(2000);
6 W$ R8 ?6 d t* I : G5 E E; c# p
simple.CloseModel();
; z. z! [7 D% ]+ G# [simple.Quit(); ) K D: Q+ n$ `, ~, ]3 N: }$ W
WScript.Quit();
' @1 o- V6 `% g+ U* b9 H" u- f
- _& m, G- \, B. q% k 2 f6 P( ]- i) u2 s: S8 J
function RemoteControl_SimulationFinished() ; L. x' A, k" K a$ [8 E
{
2 M/ ~ E/ y) M: Y WScript.Echo("Simulation Finished!"); |