Example of a JScript
; K* P9 Q I2 O. @$ D$ Xvar vbOKCancel = 1;
& D7 h4 w$ A! {# @var vbCancel = 2; , I* q6 V1 y9 @' o- e# [5 e
var vbInformation = 64; * s# e% y2 U+ `0 S, l- ~' h
var Finished=false;
1 d* {& Q9 ^( U7 ]9 D" Y
; b4 t3 {& P$ k3 p# i% ?var WSHShell = new ActiveXObject("WScript.Shell");
. U5 Z7 d0 x/ F4 M
M5 K; B, W( T6 H1 u$ v p: nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* v( b, B0 x5 N) L: `' }$ E! y9 m
( s4 X: k$ z7 m" j' t0 B5 J# @. x, qsimple.SetLicenseType("Runtime"); $ s* K' [7 u" k$ |# Y6 { ^
. }8 L3 z1 ?8 R* Q! }' f
try # @- T$ g" v# t& @
{ ) Y5 H: l/ P: @$ Y: E# p
// Enter the path to a model file! 7 n1 s' C9 M9 e" }; h
simple.LoadModel("C:\\Models\\Test.spp");
5 ^) M6 w. {# p) J5 y} + r3 n/ s F1 S1 F
catch (e) - V) w& [$ v0 c1 h
{ 5 h- W9 `1 i: ]/ x4 H0 a
WScript.Echo("Could not load Model!"); $ O v" K& ^+ W( B+ I" H: R
WScript.Quit();
$ A3 |3 S( {2 Z2 A6 }8 {& B; r}
( `4 Z( \1 G4 {7 z
9 d& O* ^, V3 B3 \/ M: i( ktry 0 J4 Z* r& J1 I# T# X( N( [% B
{
7 T& c1 ^1 {( L1 n% |2 l& _8 U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* x! M- G8 b+ u2 P' E+ [0 I r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * x8 @" w* G; [% D2 M
if (r == vbCancel)
; _7 J- d1 ~/ A/ Z- X% E8 m {
5 T3 L+ \: {. i3 j+ D simple.CloseModel(); l; [, P4 |& ~) E- D
WScript.Quit();
) l/ e ^. a4 w% Z }
, _9 `1 N1 N1 p) ?% E0 M} 3 e H; z7 q& H3 o3 q& V; s* s! Z
7 `/ V) m& }; y8 K
simple.StartSimulation(".Models.Frame.EventController"); ; n0 j5 n7 P8 K4 Y6 R9 v4 \4 u
" r0 b6 y# V# S2 b0 Z# b* O: z
if (simple.IsSimulationRunning())
7 F! |* C4 `6 Q WScript.Echo("Simulation is running!");
8 N7 z8 m! H/ l$ s7 Y9 n( c 9 P7 f) ~1 J7 ~3 a2 r
// Wait until simulation is finished
0 N' Q& o# w6 M# I, \4 Pwhile (!Finished) WScript.Sleep(2000);
/ C% c, v' T! i8 x9 \5 W9 `. T
9 E* { W# \8 X; r, Rsimple.CloseModel();
/ L6 U% }6 u! i& ~; Fsimple.Quit(); 3 O) m) A$ c7 [2 H$ i/ J5 N: @/ j
WScript.Quit(); 2 E- R# C" X3 L3 q/ ^
& J! G8 b9 r/ O9 N- A9 k
4 k3 |3 {5 r( f6 M9 w, r
function RemoteControl_SimulationFinished()
# ?) t+ {3 n8 ^! U7 ]{
' ?8 n( j( z+ D/ s WScript.Echo("Simulation Finished!"); |