Example of a JScript
# Y! } I; ]* Rvar vbOKCancel = 1;
# k9 c+ n) Q! t8 ~8 Q/ x& _# Ovar vbCancel = 2; : h- N7 a; u, N9 R* I9 `$ P' S: I1 u9 \
var vbInformation = 64;
. E( y- x. n& z9 }$ Gvar Finished=false; 7 L5 _5 U3 M" n4 j+ t/ F
/ U2 \ F9 P2 tvar WSHShell = new ActiveXObject("WScript.Shell"); K7 s+ T! P4 k/ c
& B- G8 {8 S2 M0 h: Z. U' a6 W
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " c7 Q: [. _# W& c
6 ^4 j1 W' V2 h: Q$ fsimple.SetLicenseType("Runtime");
5 j8 a* V3 n0 x: R
8 |2 l p% |$ F! A) u- |try & r6 D: G' ?4 U, U1 x% Z7 w
{ ) u# R+ w: K* j
// Enter the path to a model file!
5 C; e8 p. m* |3 Q simple.LoadModel("C:\\Models\\Test.spp");
4 Y2 t! a: B }) s) z' S8 K}
1 ?0 d7 C4 S2 ^- t, g2 I* ocatch (e)
% A5 x* T, _, t6 W: n6 Q2 G{
+ t+ `; L. ^ v2 d/ W' U3 L8 v5 E WScript.Echo("Could not load Model!");
# D) k0 y ?* K8 ~& p9 e+ V, M WScript.Quit(); 6 f* ~ M. B7 M
} ; ?! ]0 z4 a3 e; K" y5 `3 K) H
! T, M: Y! _5 t7 f4 k9 T# m2 H
try
4 f2 T$ ~* R& L% m{ - ^* N- R( D4 E. \6 _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( {7 _* ?* z/ U3 V( H {& N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: i: c+ X/ P3 F' n6 l& I* z" A if (r == vbCancel)
& h9 X, k2 J1 S# q {
2 C) w# g f& s# c1 S8 _ simple.CloseModel();
# \% P: z- v3 |) R0 q9 D- d+ z WScript.Quit(); 9 k# i$ ^+ ~+ c( M/ Y! X% J
} R K X6 n* S1 V' N
}
, w) n3 L' F8 o% J( D( s% k
9 i6 A4 Z8 Q+ X0 S6 k( u. q% usimple.StartSimulation(".Models.Frame.EventController");
: U% T+ ^( q9 I- G ( ?/ h' I, {+ @! {" Y# {! B) J2 O; D
if (simple.IsSimulationRunning())
7 R& I2 s, O# ~" P' E WScript.Echo("Simulation is running!"); 4 C$ o& M2 s* H1 J3 j
# r; A& j, x, F. z$ @
// Wait until simulation is finished ; e- @4 v7 Q9 a' A
while (!Finished) WScript.Sleep(2000); 1 x3 C! U6 g ?( c
: Y- j' t4 U+ e& F* Msimple.CloseModel();
. k; |: L9 \- ~6 Msimple.Quit();
* g' l) f1 f) H6 y0 ^5 yWScript.Quit();
' Y9 |. Y; l- A& q5 ~6 @ ?5 N) z2 J1 i
- c' _. ?5 k4 K" _function RemoteControl_SimulationFinished()
/ @) R( Q0 n* R7 m' H7 j3 z{ 1 A* Y, A% X8 o& |' K, ?+ Z- g" ?
WScript.Echo("Simulation Finished!"); |