Example of a JScript
$ j% Y& `9 h; hvar vbOKCancel = 1;
F1 u+ T, Z3 g( P* f4 c/ Tvar vbCancel = 2;
+ n1 ?( ] g! H7 r2 d2 y' R7 Wvar vbInformation = 64; " T/ U- O( u# ~# F( X% Z, ` |' \
var Finished=false;
9 {/ c8 ~( _) X3 i) n! ?
# H n# m3 V( C" hvar WSHShell = new ActiveXObject("WScript.Shell");
8 V N, c1 n1 h
9 D: B+ v6 P9 S+ Mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ \) i! e/ |! c( j0 T
8 {9 X& z: z9 |" O' y
simple.SetLicenseType("Runtime"); ) \/ k, x7 l7 q0 r7 e
% C) V, O/ f9 M! A( R$ {try ) @. [% d' T" b) `
{ ' g( N r9 o5 b+ E/ B" y3 D
// Enter the path to a model file! ' {2 S9 l* f X
simple.LoadModel("C:\\Models\\Test.spp"); * E; d1 V" I. o$ H/ v; [
} ' e2 ^5 p& W- |0 m
catch (e)
" I, [" l/ p6 X8 E{
: L: m2 [6 P' l% H Y" B WScript.Echo("Could not load Model!"); ) V/ X: h7 i' I: _& b4 k [. Q- ]& H
WScript.Quit();
& v9 g! M' l- a0 i} & ]* N1 z6 m( N+ I. B" i- L
0 b9 q: [6 P+ L% htry
- J7 v. g( D: p# a7 x{ 0 `4 a; T: F k6 r9 [6 h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : l6 V* ^% m$ U4 S
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * T4 f1 N7 z& F' W: O
if (r == vbCancel)
/ e( m \6 p' j" a8 Z: V7 b { # \. t6 [& K) z j
simple.CloseModel();
$ `! p3 E1 Y* @. a+ r3 [: e WScript.Quit(); 6 t( }- a7 A T9 X; _5 J7 D) m5 |6 }; S
} 7 r1 L+ u0 L) |; ^ Z
}
3 _2 A" n" D s1 D6 V6 P; a ( P: m: H; `" F) ]2 z
simple.StartSimulation(".Models.Frame.EventController");
. M6 o. k' ^8 J1 Y
! q, M4 a) T( \6 X R' M1 Vif (simple.IsSimulationRunning()) 9 ~ w6 x: E; C4 S' D6 m
WScript.Echo("Simulation is running!"); ( L( V' I$ a3 r7 v1 F! i
9 n- f7 ~) {$ t/ k5 l* c- s
// Wait until simulation is finished
; @. n7 C/ v. c' M/ c5 qwhile (!Finished) WScript.Sleep(2000);
& k! W0 i3 {2 I
; o2 x; K5 ?" }! Z6 R: V8 Ysimple.CloseModel();
5 |% Y" D1 ]4 W/ C5 M( usimple.Quit(); 3 V& L$ G7 @3 _: |" x( x2 h) D8 J
WScript.Quit();
/ R- B$ D3 q! h4 e" M8 {5 Q; v' @% X( P * [ }; { \, x9 ^+ v3 B
6 u+ d2 p( f( G5 C
function RemoteControl_SimulationFinished()
2 U7 L' a z. f a) Z{ ' i2 m% ^3 g0 d% T9 l
WScript.Echo("Simulation Finished!"); |