Example of a JScript
' V( _* ?# _! ~& V% W) nvar vbOKCancel = 1; + E8 y! g# B% V s; b& r
var vbCancel = 2; . M, X& `3 A; w/ P9 f& Y1 b
var vbInformation = 64; 5 F7 {7 k3 r. X( ^
var Finished=false; ; o# O: j: t w7 ~6 o/ S: ]/ O: p
4 c, k4 f1 z Y3 n+ t
var WSHShell = new ActiveXObject("WScript.Shell"); % I4 h" S a* O8 Z
) K. ^; P0 L9 X) W, l9 dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + E9 g! B' `' v$ ^. S# K) t
: X% C |( d; X* H1 Vsimple.SetLicenseType("Runtime");
4 D! n+ Q3 h7 `9 p
5 b" H1 S( Q* E; Z) stry
8 i3 ]; ~( T6 z$ ]3 S+ J) Q, u{ : J x+ } s# m1 }5 L* f+ T4 x
// Enter the path to a model file!
7 z; g# Q5 P$ r: R, P! r simple.LoadModel("C:\\Models\\Test.spp");
) V9 Y% H, m* L7 r3 f% G}
7 @- d9 d' L+ t4 a& l) L; ^ fcatch (e)
F: o1 C+ T0 L! j% n{ 3 v2 ]( c5 L7 e! ?
WScript.Echo("Could not load Model!"); 9 D5 i$ ]/ p* x; r) k8 |
WScript.Quit();
9 b' U4 W( k x$ X}
4 h9 E& ] g# y6 K7 z, g0 C+ {
9 {) W; T! g1 V K; x; F& V" Vtry
- k7 Z( t# o4 Z5 @. K{ # G2 z, M7 C8 r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 I$ V j1 y# W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' S# c2 @1 ]2 V( n) h* Z
if (r == vbCancel) & p+ O0 m. @6 C/ X6 R5 K7 d
{
' A2 j2 m! h( S5 l simple.CloseModel();
) O) l, S4 x4 y% N WScript.Quit(); & b9 ?( N0 A% q/ i
} ) P4 f+ |7 i: w* ^
} 2 y4 w. b0 `/ i$ q5 q+ o9 R
6 r8 s$ a% H i% q2 [simple.StartSimulation(".Models.Frame.EventController"); ! t! z( S$ `/ J& @6 S8 w2 }; v
, U6 Z+ Q# G! G7 Rif (simple.IsSimulationRunning())
7 k- V4 W1 T [ WScript.Echo("Simulation is running!"); 8 D; G" X; O! `' ]! G
! Q& K5 R, j8 F( l2 k6 P R// Wait until simulation is finished
% ]/ \: [& V* X3 `; R& ~while (!Finished) WScript.Sleep(2000); D& K5 |5 o. q; x& b- z) i+ G
2 P0 P& ~5 l7 K1 p! V; r, T4 X7 H
simple.CloseModel();
) M. p* x* n6 ~7 F l6 x* q: ssimple.Quit();
8 G% j; e T2 d# ], hWScript.Quit(); . P& v! f% [+ S
! j8 L9 f6 o+ u$ z
2 o+ x- y2 U7 `1 |
function RemoteControl_SimulationFinished()
/ w9 }2 n; l& M( P+ v6 Z8 s0 d7 |{ 0 J- A6 m5 R7 Y; ?* H
WScript.Echo("Simulation Finished!"); |