Example of a JScript & ]# q6 ?4 A' O: z; C
var vbOKCancel = 1; % \8 _3 V* x# V; H% ^8 H9 b) X
var vbCancel = 2;
# N3 @ B2 O y, s) yvar vbInformation = 64;
2 d- i2 ^! `+ h9 }: z9 Kvar Finished=false;
; O0 }7 D+ D4 m9 E
; v: ]2 C" B# |' s+ s G8 ivar WSHShell = new ActiveXObject("WScript.Shell"); ( q5 l5 b T" G/ X" ]. E/ U
% o& j# u' f0 G% C' C1 n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( b6 e; @+ k% d: D0 [$ e# X+ }
9 ~' L+ R u' R6 o8 u2 Wsimple.SetLicenseType("Runtime"); 9 K! u# j7 u: V$ ~3 Z$ P/ c& M
8 }1 |& g# F$ W$ Y# v, @; C- O, rtry - \: j J* ?$ n& H+ M
{ 0 W5 |; @+ [( Z% W$ K
// Enter the path to a model file! $ v; F! q, c% [8 \1 @5 R1 T) V% {
simple.LoadModel("C:\\Models\\Test.spp"); 7 c8 H `& E. h4 K5 ~+ G3 X7 Z
}
; e/ {# D2 h4 [: ncatch (e) : y6 b3 x: N. l' n l, K) ^, L
{
1 N6 b3 k3 f" H2 w, } WScript.Echo("Could not load Model!");
+ Q- H6 Q7 U: B2 A0 i; _ WScript.Quit();
8 s1 K0 S4 U" S/ I; |} ) X! w+ f8 h$ l
1 W. {" w# a. I( {try
# U- ^5 _& _5 p% t3 {$ Q9 y* H{
- E- ]6 P' y3 ]: T, ~2 c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' C4 @$ \2 R$ F2 f/ G! B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); A0 f& Z9 I1 G4 Z) o3 h2 D
if (r == vbCancel) # v a: D5 B/ O
{
5 W' l0 E; ~" @) j1 `9 W0 ^; Q" G simple.CloseModel(); . T; |. {. w9 `6 P8 I2 B+ h
WScript.Quit();
# D* C3 S: N; I" A3 z* w% @+ W } + Y7 i6 h" X6 [1 ` {
}
; I W8 a2 E4 ^8 ]& x! E* }- X 2 c* o) ?1 S7 L1 n
simple.StartSimulation(".Models.Frame.EventController");
( d( p3 a% G; X
# v: l7 z6 J+ }- Y Y* iif (simple.IsSimulationRunning()) 7 q" M+ p# b- I; G1 l8 ^ e, r O
WScript.Echo("Simulation is running!"); 6 s- y2 O5 I+ q( P' U" l
- q- n# a/ R$ H" n# T4 q1 v0 Y6 y% h// Wait until simulation is finished 9 C% O$ h* b' ~( {6 t
while (!Finished) WScript.Sleep(2000); + a, V) V3 b7 ~$ Q
2 s; D1 h1 X* L y
simple.CloseModel();
# ` m0 K" q4 p! V7 Csimple.Quit();
& a V: k% W, a o; ?WScript.Quit();
5 M. \) b# C9 T9 {9 K 4 F# b: u h; C! P
& t2 a" \$ ]9 B8 ~9 bfunction RemoteControl_SimulationFinished()
9 j- X( o5 Y. z/ G{ , C& D: \9 c; A: x6 ~
WScript.Echo("Simulation Finished!"); |