Example of a JScript
& ^% {' A9 A5 H3 e' Mvar vbOKCancel = 1; 5 z1 Z/ R) D1 R: V
var vbCancel = 2;
* i4 e8 l0 n7 N: Yvar vbInformation = 64;
( z# [8 e \1 G1 [$ S6 A* t* jvar Finished=false; 0 I: b& u5 s7 ~# V
; O1 H7 `% L' Avar WSHShell = new ActiveXObject("WScript.Shell");
) Y3 F4 l B, c1 V9 F% b ( B; e6 {6 H" [6 H [$ V( O# L( h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , a+ S4 k- ^0 k" V# @! y. G
2 @! D/ L A! ^( v/ D
simple.SetLicenseType("Runtime"); 4 W& u% {5 E& t; w1 r/ a9 B+ H
, a, ?0 `3 f3 x' A$ E1 o* M' K
try
& L8 K; Y" Y1 A( F' w8 e{ + G8 Y3 ~$ S- h( ?* y
// Enter the path to a model file!
1 y5 Y- w' Y8 @& g& T% ~& { simple.LoadModel("C:\\Models\\Test.spp"); . c2 A" ?4 r3 h2 q& P* t
}
4 Q5 h! S" b0 u) t( }& Ccatch (e)
. Y$ L5 u8 k- |{
( b& n+ \' y* b5 G6 ^ WScript.Echo("Could not load Model!"); & @2 v( ~: Z5 u0 @) m1 e
WScript.Quit();
0 h/ E9 e% e: u4 y* ^3 c}
1 G" D$ t5 t }8 H9 x
9 C3 g- U; _' \' F: utry ( w/ h B1 x% {( ?4 y
{
+ Q' U. ^. v+ C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { U* q+ Z6 v' F+ F* }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 5 [$ Y. T' L$ c4 m
if (r == vbCancel) ( x" l* l# o7 v; Y- e
{ ' j# J5 T$ ?6 F0 V1 N) X
simple.CloseModel();
4 L. q- S. B+ v2 p9 o WScript.Quit(); - g( u7 k8 ~: H& X* t5 D
}
, @. X ? A9 F4 E6 U& }4 N' @4 b3 q}
, @ `9 \5 u8 N1 q1 {. n
4 e m% k1 A% Z% N7 L) rsimple.StartSimulation(".Models.Frame.EventController"); ; U9 g- Y% U- m; i% v
" G$ u# Q' P3 F( y" l
if (simple.IsSimulationRunning())
f: N' D- r6 V4 Q3 K# _ g- L6 `. d WScript.Echo("Simulation is running!"); 8 s5 [0 X/ F, V2 _. U
* t' j# i% ~9 g9 I
// Wait until simulation is finished
{1 Y! W! n- Y% Vwhile (!Finished) WScript.Sleep(2000); & @3 P3 f& V( b8 M' v& I4 E
* R0 D, P8 P$ G7 ^9 [# w
simple.CloseModel(); * E2 M' |1 N0 W! w" Y% \& m
simple.Quit();
. U1 g& m i, I" W. ]8 O& E4 A2 k! C% MWScript.Quit(); - z- [0 d" U/ g% B3 P
. s3 |+ k: i3 ?
4 J. n! n9 u$ j% zfunction RemoteControl_SimulationFinished() ; r, B. P' ]0 O1 L$ h9 K7 o/ [1 H+ }
{ 5 x2 P* l9 H" t
WScript.Echo("Simulation Finished!"); |