Example of a JScript
3 {* n$ G% {, I5 Y- x/ `var vbOKCancel = 1; $ g; [% v7 }4 p3 L& u3 ^' H
var vbCancel = 2;
+ R0 }% Q4 c1 U9 v3 Y1 r. mvar vbInformation = 64; # m ~- x ~7 H+ ^6 `
var Finished=false; % U) E: P- F( s9 {' Y$ h+ G9 E
7 q$ ]# H8 A3 }: f
var WSHShell = new ActiveXObject("WScript.Shell"); * j( \7 k4 x9 @" T+ n
. Z/ @* V: r$ v, l. _0 P4 n! vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: |/ s5 p8 j' I& [# d/ K
0 X: ?) j( y- P% isimple.SetLicenseType("Runtime"); ; N$ K2 |7 r% G6 [; r; T, \9 h" {
8 v+ n+ }" H) ~5 o& T0 }* K; Z
try $ I/ A, w2 _4 s3 m- C* O/ y
{ % E$ f1 q8 x9 M* y6 f$ {
// Enter the path to a model file!
% @& Y/ ~5 n4 \4 ~3 E* H simple.LoadModel("C:\\Models\\Test.spp"); ) J* }+ g7 L8 s/ K- S
}
5 W/ o E: W/ [9 ~catch (e)
8 {: w; Z2 @% K& i5 r) _- @, [{
' N( l- R3 I. ]+ L3 C- v WScript.Echo("Could not load Model!");
5 p2 N- {, y( U. L0 W WScript.Quit(); ! l- V5 t' Z) O1 o5 }) K3 k
}
( c" R" ?) p4 n 0 E6 P% f/ r0 s6 O
try
8 @$ E9 c# R- m7 C3 _{
9 Y7 f* q$ N, C! A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # K, S% _/ C2 [% q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 M/ v; j, E8 ?& u9 }0 A
if (r == vbCancel) ) I s2 R2 E9 ~2 K; e( H
{
, ?+ O8 `# D% c! B3 X" ^ K9 G simple.CloseModel();
# N8 `* e" z6 O WScript.Quit(); & }7 Q+ I0 f1 ~7 z' Q
}
( @' h) H% t6 R} 9 H: x2 W2 d: _5 T% |- h
+ B: B5 e: h |- {! Y4 K# d/ @simple.StartSimulation(".Models.Frame.EventController");
- N) j( Q# _) a$ S ' z. b/ e; r/ H+ `5 @% {, B
if (simple.IsSimulationRunning())
+ Y4 m; Z: W8 y+ @0 m- w4 b) [ WScript.Echo("Simulation is running!"); 5 g" A4 q6 }8 r9 p# o5 `; I6 }: @
. z/ ~/ @8 `/ {4 {9 ]
// Wait until simulation is finished 1 {8 u. d! z4 x1 Z9 G/ b
while (!Finished) WScript.Sleep(2000); % {- p$ i6 D# A* @: ]
2 X9 c3 U' ~, ~1 B' _simple.CloseModel();
z! v' i6 D9 K- vsimple.Quit();
. z( v; f# U) d- [# MWScript.Quit();
9 W% U9 I4 ^! S1 {4 G# o1 r4 p - E P0 n5 w- y$ x$ q d+ ^
+ m0 w8 ^% [1 r" X4 P9 j
function RemoteControl_SimulationFinished() / w3 [' @1 n P$ L F% Y
{
' U q1 E! ]8 C/ J WScript.Echo("Simulation Finished!"); |