Example of a JScript - T, @5 e, D8 K' [3 G: U4 \+ K! Q: E
var vbOKCancel = 1;
* C% U; N5 q) G$ yvar vbCancel = 2; - f- S- _8 `2 ?8 }) e: _
var vbInformation = 64;
7 @3 d2 M A7 V! nvar Finished=false;
4 W0 ^1 c0 W6 c/ `1 x/ @7 u! h( R
0 L1 ]' ~ g$ `var WSHShell = new ActiveXObject("WScript.Shell"); 1 I! P S7 C* l& o
' P& E( R$ _9 b3 c8 a
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; J' `5 J; }" G9 Y" g, i9 B D: P
/ x& z! V* J1 O2 r* w& b& Rsimple.SetLicenseType("Runtime"); * O/ r9 R) C/ ]
% P/ p- E! i7 q* V- c& e: ftry
/ G: ]2 b4 w( G7 B- h7 j{ & Q* u2 d# k |# Z2 W3 B
// Enter the path to a model file! " O1 p' l9 |, w: E- H
simple.LoadModel("C:\\Models\\Test.spp"); 9 x; d: ~$ D9 r
} " @6 d9 B( \. n6 g6 W2 n) K
catch (e) h1 L% W$ J$ N* x- e# {
{ * X, d5 v0 {1 l1 o& m
WScript.Echo("Could not load Model!"); : [$ S! e* Q; s
WScript.Quit();
! _0 a0 H, {; M' C- g- S}
2 \7 X& t# D; W0 g/ z
; }. O+ \6 \0 W% l( R8 z2 wtry ! x% V: F5 u2 {/ H& ?# }
{ / u+ ]& h) W& o, S8 q2 h! h8 m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! s* m8 E7 t4 ^, h+ T3 D4 U
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) r+ `; p4 t0 a: g6 H3 G
if (r == vbCancel) ! A6 r4 x- Z' c0 r/ E
{ 3 ~7 L9 t4 u8 i; C: }# b' p
simple.CloseModel();
1 G {7 G1 l0 C& ?8 u WScript.Quit();
1 c" u! F+ F# r! o8 j' X) L } # ?& J6 {5 Y& U4 x, \
} 6 s; f9 L5 `0 ?9 @6 a% `- [
* i* B# n% b2 G% ^1 Z1 t' | o
simple.StartSimulation(".Models.Frame.EventController"); * l% A# p! q% D
. U# a9 w/ p# q: [7 @! Wif (simple.IsSimulationRunning()) 3 H6 k( t. ~# f; j
WScript.Echo("Simulation is running!"); 3 x- k$ n$ ]5 n! z
% l7 Y2 a0 Y' y! ?
// Wait until simulation is finished
/ v* W1 D' R' N- Twhile (!Finished) WScript.Sleep(2000); ; y0 i3 T- y$ z4 |: O3 F5 x
, ?, X% R9 |, Tsimple.CloseModel();
5 M% O6 }4 p( [1 d* ~, hsimple.Quit();
, n: L7 n7 M$ U& ?WScript.Quit(); ' ?% M4 `0 V, K- M2 [7 _
8 x$ }- z- [+ h V$ \
5 K1 Z% Q9 Y& t8 h2 p
function RemoteControl_SimulationFinished() ' r$ x @0 H5 W0 J: Q
{ 6 r/ t( B M" I" ^% H) O' I& q
WScript.Echo("Simulation Finished!"); |