Example of a JScript ( ?7 m, p' g, n' |0 @* p0 o
var vbOKCancel = 1;
# @) e0 k" j5 n+ V/ `$ [" j7 T% F: H4 Nvar vbCancel = 2;
* g* W; B* H S8 {+ xvar vbInformation = 64; + [, s# K* { m* v9 v3 K% E
var Finished=false;
; e! T( _. \5 X6 n7 I1 M1 c4 i
* p- {/ n: Y" i# Uvar WSHShell = new ActiveXObject("WScript.Shell");
* V0 S: s# }$ V4 y + E' H+ J1 U3 ~! P% l, I& f% j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, ?- I2 v1 r0 D( l7 ]) J+ x$ C) c : C4 Y' ~3 p5 X: B# x4 u" R$ W- J
simple.SetLicenseType("Runtime");
6 }. b2 I3 e$ t7 A7 s6 B1 u) M# F% d
- ^0 d: v, X' M2 g7 [/ }$ ftry
; ]. |% E8 K8 v8 T! @" o* C{ 5 c+ M: e& X% X. [
// Enter the path to a model file!
0 s! s$ v8 y2 O) f simple.LoadModel("C:\\Models\\Test.spp");
7 v7 V: A! G& u& N5 ]} 7 R7 s' _2 F" {0 o" J
catch (e)
9 g8 p" J3 q' n8 ]{
$ `0 `( M- H+ }% X! U, V! R WScript.Echo("Could not load Model!");
" S9 {8 u5 m; \0 F4 r WScript.Quit(); # {& M0 M( `4 d' j& o, U9 \
} l& X; {) e$ h
0 @+ \% c8 A1 n3 @: i7 Q2 w6 Gtry ; d4 D M% g$ ]2 [
{ , V4 u( M T4 z( I. c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . F8 O2 g7 G7 L, [: u: g/ K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # f. s- `) r: {+ h( U! k2 }
if (r == vbCancel)
4 C+ W: ~3 ?' X4 c# z {
, V' X- Q; J' g; w0 K9 m$ R simple.CloseModel();
1 H* L$ w0 _1 ~9 c4 Z# }$ R WScript.Quit(); 2 `* m7 C' c, D0 @& e. Y
} * z3 Y& ]; Y3 y# W/ i' ?1 y
} . V. r+ v: D G" Y: T7 ?& W
' m& G, u/ t. o/ v5 C
simple.StartSimulation(".Models.Frame.EventController"); ! s; `2 w" d- r1 m3 p8 H; V
: i% A. s, D: B! jif (simple.IsSimulationRunning())
L# B# _) s4 L r WScript.Echo("Simulation is running!");
9 w5 P, t$ ]/ e9 G- g |; w4 g) q7 e. V0 E x
// Wait until simulation is finished
' e) B- n+ w2 `: r) L4 d$ c' ywhile (!Finished) WScript.Sleep(2000);
+ ~6 L0 X( ^0 p
7 p; N; c+ s1 F+ M3 k! Ssimple.CloseModel();
0 M2 Q; K$ ` msimple.Quit(); 0 B* F0 j2 O3 b5 `* ]
WScript.Quit(); 9 L0 ]6 f$ d4 \% o0 [4 C
/ n2 _6 z; S# G; Z- `4 U
7 l9 W# [4 o! G. \' yfunction RemoteControl_SimulationFinished() 0 K+ ?( I6 M8 a' D
{ ! g& m6 |4 Z8 T+ s. ^" G- K s0 C
WScript.Echo("Simulation Finished!"); |