Example of a JScript
R$ x6 \( a% ^$ @ ovar vbOKCancel = 1; " H2 {; l2 r$ A% ~8 m+ G8 }
var vbCancel = 2; ' F1 s* I! |& g5 x- C1 b
var vbInformation = 64;
a' p6 @* K* }/ }4 i! @0 \var Finished=false;
! N( Z$ I8 G6 Y, U" \! L3 J$ q
" K) m! L8 Y$ avar WSHShell = new ActiveXObject("WScript.Shell");
: }8 O' Z+ B/ f7 q; R' P ! g( ~$ n* r- o5 p2 N) J
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 l8 ]& u- O6 R7 R) d6 j3 X8 x 8 j, y6 c" E# {$ A
simple.SetLicenseType("Runtime"); 8 [8 G: w Y/ g1 G
% o! ^ T% ?% }" z+ ]$ i. r
try 7 @, B" B' ?$ o( j7 @+ @! v
{ . ~. B6 z: o3 J/ ]5 `/ y
// Enter the path to a model file! / r9 L( |( L. `8 H
simple.LoadModel("C:\\Models\\Test.spp"); ) s' Z5 }: `) T" y9 T9 n
} 1 s: o: |# D* H6 P- X; E* G5 }( v
catch (e)
2 E6 p" K0 i- G{
2 K( Z6 I# h- @- Y+ N WScript.Echo("Could not load Model!"); " n0 W. r% Y0 {/ A
WScript.Quit(); 2 z% H( R/ [, I% d- |
} # c1 O, F# R5 ^& f" A% W7 V
$ M$ @4 n' j; ^% M8 Q
try - H7 z8 K7 \% o" q6 H" i
{ ( {$ M+ `9 y8 k+ ^ n# M; `
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" r8 d# t: U* m# ?: }, E% S r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( f7 g5 E5 x( j3 d' ?) N
if (r == vbCancel)
) D% K& w, a+ y/ u5 ] { 7 [, [) L' {! N: f
simple.CloseModel();
0 R' x$ z1 G- j! Q: M+ O: X WScript.Quit();
, l8 a& ~6 M/ L0 g } ; Q$ J: v+ Q& s5 _+ }
} 0 n' J ~$ h- O8 p6 H1 I2 w
: x4 e. ^0 z$ r2 H& N7 ~5 A; {5 Y
simple.StartSimulation(".Models.Frame.EventController");
& s3 z# Y2 w& z. L3 R: t6 |
& [5 P8 v2 ~5 |* yif (simple.IsSimulationRunning())
. y- z/ c# k+ a8 A/ I8 `1 | WScript.Echo("Simulation is running!");
) g8 l" v c* q . e5 ^5 K8 G- T: r- O: F; H$ k0 A
// Wait until simulation is finished
4 b0 b1 F2 r) Swhile (!Finished) WScript.Sleep(2000);
9 S G) r$ N7 |' O( y N % A3 m4 _# U" z f( |
simple.CloseModel(); $ ~) J* ]; a% d3 C- O5 T& d
simple.Quit();
0 R7 w' n) I5 _% DWScript.Quit();
, C0 ?( y/ K3 ^; X
4 ~/ r/ d' }/ Y6 ]8 A1 R& Z/ w- E
q" y$ D& l1 u3 a5 i. P) ffunction RemoteControl_SimulationFinished() / }2 h6 W, X j
{
9 [% i# A* Y7 q( T8 ?; E- { WScript.Echo("Simulation Finished!"); |