Example of a JScript
: E3 h2 u% G- X/ a' U1 t: L$ }var vbOKCancel = 1; ! a' H. V8 L; j8 O' t" V% N
var vbCancel = 2; ! `# r! T9 v, `
var vbInformation = 64; ( F' H* Z' e6 J F6 m
var Finished=false; % r) F- D R/ u
2 o" W1 `) P' V; C
var WSHShell = new ActiveXObject("WScript.Shell"); ! _$ Z: K0 x6 K
0 U0 U" x) i: z) z; Avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % ?8 y: s _8 r
- p) C( Y: h, @3 ^0 A0 |2 E) B Msimple.SetLicenseType("Runtime");
# h( B; B3 ^8 H! K+ ] ( x$ J$ `0 n- S* D! p6 T: M: w
try " r% B* o6 K% L. b
{
( T5 w3 { x! T! m, ~ // Enter the path to a model file!
' _& s+ s0 U! ` simple.LoadModel("C:\\Models\\Test.spp"); ) ` K/ P s* X
} ; P% X5 G' ~3 e) I1 {* F0 J; F
catch (e)
1 I& y! D- _5 o# | {{
|! Q2 ?. } P5 x+ v+ Q WScript.Echo("Could not load Model!"); 3 i" [* Z- b* i1 l3 d: n) e& M0 @
WScript.Quit(); 3 o: b' X5 H1 `+ n& y
} - c# x& n1 b) U( C9 }7 M
; W2 w, N! \& D* c2 C; v
try
4 M1 @9 r; n( q- ]9 Y4 v{ 9 e# P- f9 O8 F+ l8 ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 s' v+ @0 C$ Y \" {1 D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 a6 S! d' {) \8 a g
if (r == vbCancel) ) p0 C# ]; e8 O+ y7 f' Z) U9 Z
{ ]6 ^8 ^( @9 Z8 I- Q1 R
simple.CloseModel();
& X8 ?- ?! a& x; E% A WScript.Quit();
5 M/ X9 s, E0 v6 K1 B } 7 q. |: [$ G2 H' q6 w8 t6 K* i
}
6 y! s. F: q: K/ [ , @0 o5 f, [/ G& t' ?0 `( _8 o
simple.StartSimulation(".Models.Frame.EventController");
; T( w* K, U7 K8 m% L: D
( r" F! w. \$ Y. ^if (simple.IsSimulationRunning()) ; l) J) r4 d- p* u$ M. P
WScript.Echo("Simulation is running!"); / n" |$ L$ Z' z* u9 D. [
. h3 m% X# E }0 I2 V
// Wait until simulation is finished
3 ]3 Z1 t/ n8 J1 l5 a3 uwhile (!Finished) WScript.Sleep(2000);
* i0 c# M+ S$ R8 i 8 K4 c! C N5 q5 ]+ e! d, v
simple.CloseModel(); 5 t( j- {0 V5 U- `
simple.Quit();
/ F' s* }. r# x( J* J* CWScript.Quit();
: @+ L) E* k& _ d# b& ^9 u7 x( U% A+ f
7 |! g3 U, u: g3 u5 D } 2 K* j% A+ \$ P% z4 }" ?, ?
function RemoteControl_SimulationFinished() 2 ~: ]' B2 L- f) W0 _. t7 q4 h. D
{
% _" b/ c* F! r# v. y; F) _3 s WScript.Echo("Simulation Finished!"); |