Example of a JScript
) D0 g0 v$ ^; E: H! P& @) h/ ]' `var vbOKCancel = 1; $ V3 H, H. X, B# y9 K4 m
var vbCancel = 2;
$ y$ B3 M |( Y& X. yvar vbInformation = 64;
2 G0 q' a! R( ?; O3 Y2 q! ~var Finished=false; 2 O0 r: X% A; ]$ y, }2 x& \
3 g+ Q+ n# ?4 p: qvar WSHShell = new ActiveXObject("WScript.Shell"); 1 d- R4 V& N0 ?0 H! v& h0 S
. [0 d7 Z( g7 v- h) avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 H9 ?4 r" c+ S! w# H2 m) ` 9 w" E3 d9 w. x- ?
simple.SetLicenseType("Runtime"); # K7 U0 h4 z7 g$ }1 v0 \8 [
. h/ Z% ?! V+ ~- c0 V) {" s
try
, W- X5 K1 a( \% y' j3 J, o/ @5 R4 |$ V; _{ + Q3 R, j3 c2 [3 Q" n! v7 {
// Enter the path to a model file!
' U+ L" W, ^* t( Y0 l8 O: n4 d; i simple.LoadModel("C:\\Models\\Test.spp"); ' b4 [3 |: ^$ r# E! p
} # M6 q& E8 e: k0 x
catch (e)
' j& M0 @" [8 b2 M' F' q{ 0 c3 |' z0 [) j f$ d& C% U
WScript.Echo("Could not load Model!"); ) \, S& m% N0 j
WScript.Quit();
. a7 `: Z7 i- u$ ]6 r) D} 1 a" w* R5 r% e% s! i! H3 B
% m1 Y- l4 ^0 D% @4 ? _try
^$ J& J3 X0 z3 L# z{
1 |5 Y- o- M5 x0 f; B9 z% Z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. o8 z/ H/ E; ^; _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ m$ O; _$ [+ N! L; t3 Y7 f
if (r == vbCancel) 2 ?2 H( v! a& T( G% K% ]
{ $ n7 U& Z% [ s: Y' L6 b' X
simple.CloseModel();
! p% ]" K! u$ \, A( W WScript.Quit(); * E# O1 Q1 @% a
}
- {& N; |1 I9 Y x# d}
# y. i, v) g, F9 K. [, O * p- s+ q, S5 ^+ j5 J/ h" B
simple.StartSimulation(".Models.Frame.EventController"); / D4 C# J8 l6 ~9 K% s
( S) g; p. @% G* L4 m
if (simple.IsSimulationRunning()) $ y6 a- L6 L9 d) A
WScript.Echo("Simulation is running!"); / o E6 O; [+ u4 [4 l; o$ W- N
% ~4 K+ u! K- c. O# ^
// Wait until simulation is finished ( m. X5 _. x0 C0 }) I
while (!Finished) WScript.Sleep(2000); 7 c! Y2 U& m& S } H8 D
/ E- m' M2 l9 M2 Csimple.CloseModel(); ; l1 y1 H5 n: \3 c1 U" b* j' k
simple.Quit();
/ [! x+ o3 a2 J6 I: r. wWScript.Quit(); + _* y$ Z6 I, Y
* J! K& j; a$ n % h5 O1 p. `! C: G( ^0 |4 c
function RemoteControl_SimulationFinished()
" [, C8 [2 ]7 Y3 W{ ( w) l1 J/ t. I& b9 W( B* b7 K
WScript.Echo("Simulation Finished!"); |