Example of a JScript
- ^0 Y+ u- ]. p5 d0 x) }' cvar vbOKCancel = 1; 0 ?3 E" K. \3 w( U( i- N
var vbCancel = 2;
$ o- {! V# m2 J$ |var vbInformation = 64;
9 c% i$ E+ p/ E V) q. Lvar Finished=false;
( X& {& Z$ ~6 W6 i& V$ K
6 }" i9 x9 S& v3 L& Vvar WSHShell = new ActiveXObject("WScript.Shell"); 7 h& ^* X6 X9 T+ w
8 n) ^7 q7 x7 v6 `1 ~% z, X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ u9 O% @& o- m& g( |8 R
4 G# \- l: U) rsimple.SetLicenseType("Runtime");
; d( W3 }9 f: m$ j& x- B8 q, b
1 X* a* f% ^' X/ G+ Otry
: ^$ j7 Z2 X0 _' Y/ @# c{
6 R* |& S: ?5 I/ f# |# y // Enter the path to a model file!
. i6 c& k% [4 B. A4 m7 p: c simple.LoadModel("C:\\Models\\Test.spp");
$ ^0 Q$ h' t' i, Q} , u \$ |7 R, w
catch (e) $ z! D% L+ r) |" z) k" N) Q' Z
{ : j4 c0 T' h7 ?: C
WScript.Echo("Could not load Model!"); : J$ w4 Y' \& H$ f: x
WScript.Quit(); 3 {/ p7 U5 y2 s: T, W& u
} 4 o! r* Y5 r% X$ i! ~" R( R: l
* _9 }( k# T1 o3 i/ J( r
try $ ~" S! {2 w4 t: s2 Q
{
( b! u1 X7 N9 k1 T7 {# n simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + B' U, o* A, j2 s% S4 ?' Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' Z2 ^0 }- | Z$ ~; q1 A if (r == vbCancel)
3 F3 R5 |7 w; X9 B: q$ E {
; _8 _4 W9 x- n- x simple.CloseModel();
2 @" I! c) t3 j ?) ^2 t WScript.Quit();
5 J. b+ ~* u& R }
5 `, k, l2 i% N" ?. ?} 7 N* W, W, ?% e# {2 h
% n6 y) D9 `0 L6 V+ Psimple.StartSimulation(".Models.Frame.EventController");
4 }- ^5 H5 }; {$ q
& t: g7 q2 D" R" j0 l; O1 [ ~* wif (simple.IsSimulationRunning()) + m; i0 D8 x, q) R* B {
WScript.Echo("Simulation is running!");
* K- G+ a) M( u: z+ g7 D) L
8 S5 {4 t. `) J; o2 c. V// Wait until simulation is finished ) {6 D; I, ]. H/ {5 z
while (!Finished) WScript.Sleep(2000);
5 } p1 I. u$ _+ u! C5 U2 q
" o6 v7 t4 y$ X) ?( }5 W5 ~; o" `simple.CloseModel();
6 S) E7 M/ P7 w9 Zsimple.Quit(); / L# w: c& C1 w. ]
WScript.Quit(); , h6 T- I5 d/ s: |- V# m/ \
2 c* T, c9 s7 [, B9 k" {0 g( K# H 6 Z* m- w+ c9 o. U1 u. H
function RemoteControl_SimulationFinished() ) \* q& v2 ]# R' Q1 Y
{ ( j( D' B6 f# s% Y1 l2 M' Q5 s
WScript.Echo("Simulation Finished!"); |