Example of a JScript
. u' g1 n$ u( R9 X3 V5 x: Lvar vbOKCancel = 1; ; I+ D% k x# z
var vbCancel = 2; " g0 M% n- \4 L; l
var vbInformation = 64; ! _% M" o- n8 n2 e# a
var Finished=false; & \6 [$ P. {. |- N% Z( }
6 v' E8 P1 v+ k0 Uvar WSHShell = new ActiveXObject("WScript.Shell"); . _8 n& @; Z. O `- D# i* r$ S
8 @4 i8 L; Z/ s. W9 _
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% C. K Z5 B" c, c 1 z9 ~; E' b b
simple.SetLicenseType("Runtime"); 0 b5 v% }( t" l2 l" n/ I2 q8 E4 ~
5 S: \. \7 A. u1 f2 V! qtry + H% ]: t5 H3 |$ B
{
9 u1 F7 P9 r1 w; O- k! k4 x // Enter the path to a model file! : X- R& _( o9 M0 J' C
simple.LoadModel("C:\\Models\\Test.spp");
* \2 ]6 U. |4 f1 p} 6 B2 w4 `# v! e, Q% m
catch (e)
# P2 g$ y& a$ d{ 5 P4 n+ V" N) V8 }+ ~; O
WScript.Echo("Could not load Model!"); 7 X2 D' c! U) i8 a
WScript.Quit();
; i/ I$ c: N$ w9 [} ! \* o7 M, J0 H5 ]1 J" H, Y
* A7 u! e, O2 R9 s' Y* E0 Q& N
try + l7 r8 x y; p) R# `/ [' G
{ " D9 r2 y5 _: y+ n2 Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ x6 v: R+ _ K' j1 M; d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% B7 S" r2 A; _ k6 w& P+ n; B if (r == vbCancel)
- X# m6 ^$ }* Q' y3 h' J {
& O2 `" f+ j3 J4 x" V3 n$ I6 s simple.CloseModel(); 5 Z, x5 g# m) x: g8 l
WScript.Quit();
5 E5 j3 r- [0 [( _3 w1 _ }
4 k' ?: `$ w- q; P3 C} ) l& A( d0 }' S) ?' a# r$ j
9 z2 O& ]4 G/ D1 n* Osimple.StartSimulation(".Models.Frame.EventController");
& c6 Z h% h3 z/ G$ T% c! c! W
& T `! r6 [6 z5 w$ h3 ~& rif (simple.IsSimulationRunning())
5 V H8 g: A: d+ e WScript.Echo("Simulation is running!"); 7 x( j# e# f, q3 S8 }2 H
; |) u. a& \& `; n$ ]
// Wait until simulation is finished + \, c. K+ Z. w& ?( [9 A9 R o
while (!Finished) WScript.Sleep(2000);
1 }8 W* V7 [- P# Q2 X2 s: p ) c1 ~0 q" `! L) R
simple.CloseModel();
7 v+ Y4 B$ m# k6 [4 Isimple.Quit(); ; j1 n8 B4 W6 `6 R
WScript.Quit();
% Y' S* ?7 T# z
+ I( D Z/ g- Z7 Y - G! B( q: N* P1 R
function RemoteControl_SimulationFinished()
t* K# f5 c. b" s) H{ / U$ P2 |3 i/ G% c2 H0 Y
WScript.Echo("Simulation Finished!"); |