Example of a JScript - \8 I' e0 S: R9 |( X9 j, O: C9 e
var vbOKCancel = 1;
/ I8 _3 H1 S7 g, [& yvar vbCancel = 2;
7 n6 c' D) k6 Cvar vbInformation = 64; + d. X7 I* l# n& B3 i. E% g
var Finished=false; 1 d1 g% t! @$ d6 O
+ v' O. H, T1 o
var WSHShell = new ActiveXObject("WScript.Shell"); ' e/ Z1 u! N5 w P ?5 v$ F; H% j6 I
8 z2 Y3 X' b" H! |4 a
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 V6 ^+ B' @" c; {. z) l1 w+ X
, _+ K4 I8 S& M4 |7 o( {
simple.SetLicenseType("Runtime");
. D" A+ a( z7 |0 A, { 4 @ k5 U' f% i8 }9 f
try
% T; D5 z3 S, W{ _" r, E- U, U( h9 L1 z
// Enter the path to a model file!
* P( k+ }0 l) s# T8 h8 c& F simple.LoadModel("C:\\Models\\Test.spp"); 9 I4 Z3 B+ o q3 Z4 k
}
6 | ~* j; Z# Ucatch (e) ' ]' [" b7 X& ~) \$ F7 Q
{
. o, S7 p5 u1 m& w" x2 _ WScript.Echo("Could not load Model!"); + a8 W0 X3 e0 u& X/ O( \
WScript.Quit(); m' ?2 e3 x) f5 x ~
}
& B+ \* z% C' B* R . R& Q" i0 H: w( a, Z
try
9 @7 @: F* M" B! |# M{ 2 z3 e6 N$ }2 \. S2 G" h# O/ n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" b& n, J! G2 |) c$ Q* x! E r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 G8 l7 |- Q B# Q5 a if (r == vbCancel) 0 i- _- s! H# U4 d! ]8 y1 Y* s
{ : e0 @. ^0 V+ v3 J7 b; z6 L
simple.CloseModel(); : r# O1 J9 X) F7 V% C1 Q1 M( C
WScript.Quit();
+ p" W- I4 o, ]$ h( r1 A2 ^- U: V }
# G3 }4 _; T- S0 }* q' S}
+ _3 B" B6 x( V ; M3 b @( `1 Z1 a, Q3 @3 q5 D2 L! N2 ?
simple.StartSimulation(".Models.Frame.EventController");
$ x( R! D4 r4 u8 _
6 b6 I) Y8 f3 {% n, h( Oif (simple.IsSimulationRunning()) + `% @- r, p3 s
WScript.Echo("Simulation is running!");
) L& M4 L' I1 m4 G$ r' c1 C N
: ~& k6 ?( t% s5 e) s3 ?// Wait until simulation is finished % c& m3 ?8 e0 j; d! ?1 Z2 S
while (!Finished) WScript.Sleep(2000);
1 T6 t8 K4 A3 I8 F
8 c+ q# J' x) e9 r; [7 @- {simple.CloseModel(); . q: e+ T: q. p0 C2 P
simple.Quit();
$ b. v8 ?- H+ f% Z' iWScript.Quit();
- Q' V: U: O% I' y # a& Q) b1 |; c B
: i# N3 u+ D W7 K! h, [
function RemoteControl_SimulationFinished()
# K" [# O9 Y6 w# \{
Q! F8 @0 M$ [4 [5 D9 r4 C! I n WScript.Echo("Simulation Finished!"); |