Example of a JScript
3 u- s3 F7 g9 u. j8 M0 w0 ?var vbOKCancel = 1;
; s! ^5 L: o5 M: u9 Vvar vbCancel = 2;
8 [ Z: g# l( N; D+ @/ dvar vbInformation = 64;
' r0 _6 K2 {" W3 F) g+ @var Finished=false;
# a2 U( C# g* s 0 G1 B$ h7 i5 U j' h$ N
var WSHShell = new ActiveXObject("WScript.Shell"); 1 J# j7 ^# k" C3 R
4 F4 B% K6 ]; k3 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' w* v# D7 {1 [0 w
1 x& p# ]' f* `7 jsimple.SetLicenseType("Runtime"); 7 ^+ k) n0 l; b* d
- |" {! E0 w. ^+ |* R7 b c
try
% i" b' x) r& u# T: a{
3 I3 k C2 e3 Q5 D // Enter the path to a model file!
8 y# A* @$ K+ t& {' a simple.LoadModel("C:\\Models\\Test.spp"); % i& \% Y: x7 F7 Q2 Q4 I
} : w; h' H9 v' `; o- ^
catch (e)
$ Y, [2 O8 C$ x" W- V{ P7 W' U6 E, l$ @
WScript.Echo("Could not load Model!"); 4 V1 S4 o8 y/ @
WScript.Quit();
& q' u8 y5 s( N6 A8 M} / E3 w4 ^2 i8 g* s! J9 m& O1 M0 I
7 @6 ?7 g8 ~$ p
try 2 z: Q2 h* w; u( Q) A$ e
{
4 a9 P4 f( P2 Y. m1 Z0 t8 G* x3 M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 H6 l+ M2 |5 ^0 s; T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 X8 b! l" \3 X8 k7 X& J
if (r == vbCancel) 9 j: `6 l3 O; M! {
{ : c6 l3 d" F& Z4 J* I, n7 w
simple.CloseModel(); . b& n/ @ F8 S- T6 F
WScript.Quit();
$ Q" F9 h4 C; N; b; h* O! {. k2 D+ ? }
8 w/ @# b0 J* M$ w( T} # z5 t" T# n0 v0 M
6 @9 L2 b+ F& M+ g! z$ c Z6 X8 w- T7 U
simple.StartSimulation(".Models.Frame.EventController"); 3 t! i( m* R5 t0 `$ j
( W* x% m) r7 c
if (simple.IsSimulationRunning()) 4 T2 C# d; ^4 ~% P" h9 [$ L! }7 k
WScript.Echo("Simulation is running!"); ! _" Y0 u$ E9 H0 o# K9 i
3 {: h+ B! {8 ^; p- b// Wait until simulation is finished
' Q% V. V% W; H; Y1 H3 U) t: |while (!Finished) WScript.Sleep(2000); 5 P& A9 ~7 G% ?+ Z1 x' E
! u" _' k9 N" _0 M
simple.CloseModel(); : ~5 ^$ D9 w' r. v
simple.Quit(); ' j" {1 L! u+ ]# i
WScript.Quit(); * a t: h) y) z6 |
' m' l2 c8 Y3 ^- L. p3 W7 O
1 n7 a: i, @9 d- yfunction RemoteControl_SimulationFinished() ; d* `& ?) d7 ]0 ~ v$ c& o& P, a! ^
{
/ `1 r6 A+ `) c# U WScript.Echo("Simulation Finished!"); |