Example of a JScript
0 x1 r* E" ~6 |1 lvar vbOKCancel = 1; 8 E- H; T, M7 o
var vbCancel = 2; % m: o' i! V, \1 ]$ `+ Z9 r
var vbInformation = 64; ( S. u6 |" T) L, G5 k
var Finished=false; * |/ n( U! F3 G. p" l8 ?7 u. |
: G" `1 F% g& l
var WSHShell = new ActiveXObject("WScript.Shell"); 0 P$ n; J; K3 I2 V8 f7 O
$ B1 ]$ E: k; ?* s" Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 P$ X, `4 T( s # w: V/ d: ?3 z3 ?9 c9 D8 S
simple.SetLicenseType("Runtime"); 0 k8 K. x6 C" u# g/ ^& Y5 L3 s- d
2 O" S: ]' I; t6 \9 i5 a3 J" Z: N% Ttry % {2 V4 \8 K; I$ ]. j
{ 1 z. `- S' b: C* N: y
// Enter the path to a model file! / E1 l- L4 t, M0 U+ d! O$ H
simple.LoadModel("C:\\Models\\Test.spp");
3 I X* b. j7 ^/ M& j}
7 e, W( E: Y+ icatch (e)
( p3 w$ U/ n6 F) ^. s{
9 b9 [! E( \( X4 m, [ WScript.Echo("Could not load Model!"); 7 d, u7 K" P f7 Y+ _/ P9 A& R) s
WScript.Quit(); ; M8 r/ j7 N5 a% ? k7 E+ `
}
9 H* ?& ^: [. v
! y5 Q0 K+ N9 U' ]* H# C, H# Itry
- g. i h& b& c0 I& u/ H{
9 \3 J' f) G$ M5 x* ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - W: x6 z. `: }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) o$ e* e5 H; t. A$ r& ~/ [
if (r == vbCancel)
6 e7 p4 L( u& A3 R+ G {
/ s. e% A" D7 t" K simple.CloseModel();
* I Z+ l; n) w: e9 c, b5 E9 a WScript.Quit(); ! W" |6 ~0 m i/ c
} * T: \# `/ U( @; i/ y
} , H0 J0 Z+ _2 @
5 c: Q. ^% D3 osimple.StartSimulation(".Models.Frame.EventController");
w* g. X, C4 S. A' h: v' M
: `( l0 w- e. xif (simple.IsSimulationRunning())
0 `- X: D! U0 [$ T WScript.Echo("Simulation is running!"); + [; D& H0 m1 P; p+ i
4 t6 M ]9 U4 q: f: K. S+ M' l5 S& d// Wait until simulation is finished
& O$ S' T6 a! ^6 y0 `while (!Finished) WScript.Sleep(2000); & v' v. X9 _( L1 c0 }/ C9 s' G, ~
: {3 J1 i7 g$ n4 {% k2 K0 _simple.CloseModel(); / A& H, N1 K2 S* r5 P5 M
simple.Quit();
( a6 z. E4 O" P; m+ g4 ]( { MWScript.Quit(); 1 f) K7 Q- E. K' j
8 D- q8 S7 F" Z/ y$ `. @3 U
1 Z6 W& V3 h. r" f* D3 ]function RemoteControl_SimulationFinished()
/ R# l& \) Q* h$ I{ & ?0 B5 o$ O2 q
WScript.Echo("Simulation Finished!"); |