Example of a JScript
* A2 \. x4 O L) P( |3 cvar vbOKCancel = 1;
, N' A ]. o; I! l8 Fvar vbCancel = 2; 9 @% i5 [6 I/ T
var vbInformation = 64; " \& f- Q( h# z9 v# j# o
var Finished=false; 8 X9 P9 p" `' t8 \9 I! I D
( J) i6 t, x& o4 e) Z3 a' ^" ]) w
var WSHShell = new ActiveXObject("WScript.Shell");
- w6 ?1 X* d% r& q" ~ * C4 m. c# z1 N8 V& U; _3 ?2 C" M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ A' [; U3 k4 V, M0 w
4 ]# J6 W1 e) u# |' z: `simple.SetLicenseType("Runtime");
/ h, ?$ @* U. N1 q4 L* n, {9 O * L4 P3 i/ p" ^" J% a7 k
try
+ j% f2 M+ R# W+ `{
, n/ E& N. f* _4 ]2 X' ` // Enter the path to a model file!
( s. q$ h |+ K4 k6 N simple.LoadModel("C:\\Models\\Test.spp"); . n& z& r3 C1 p. a' z
}
0 ~% T8 ` |4 f* N( `# L1 Scatch (e)
Z K- i6 ^. a& _- B( c: t! C{
0 n: v5 W Q: \1 }/ f WScript.Echo("Could not load Model!");
- x. f) v5 Q2 I( L WScript.Quit(); . Q" F; ?4 v0 d2 S4 ~
}
# W' h& s' N0 o: t7 v- ]/ _
d7 X# A7 t7 @$ itry
; D; P( P/ O7 ], u. ?{
% Y8 t( |& k5 P* I; C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 m0 n' h/ c6 |; M2 Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ e" ~4 g5 `1 y6 h$ a5 r8 W
if (r == vbCancel)
# c/ i8 p: E8 u1 v: b( @ {
8 ~5 y! T& q7 R8 {/ y3 Q simple.CloseModel(); $ D; d, A3 W3 Y/ G7 z
WScript.Quit(); 4 |* c0 t2 b" I* f+ ~. S0 @: `
}
5 f) V' \2 q$ s, }5 r4 ?/ c7 Z. G$ q}
9 I! G/ W$ j$ X+ v 9 _* t7 N! a5 w) c
simple.StartSimulation(".Models.Frame.EventController"); 5 l2 J& D6 K7 N
# A& W' J2 q# d3 Hif (simple.IsSimulationRunning()) . F2 [' F( P, _! m" W2 y/ U- x
WScript.Echo("Simulation is running!");
- ^$ e8 [) H( r( J( O
+ M. f- \) A& Z+ m0 P// Wait until simulation is finished
6 t5 k( M- `! N r8 \while (!Finished) WScript.Sleep(2000);
- N" U$ z/ H' l2 g7 F 3 ~ s) _" \8 ]4 Y9 ]+ [! C$ d
simple.CloseModel();
5 ]9 P5 x, m: J R& v4 e4 T9 bsimple.Quit();
) E- M1 r5 s1 x6 hWScript.Quit();
3 k, `+ V) Q3 R
3 w5 d) ^/ U' q: ~ ^1 S) e ) s; c9 t, |; E- {( F
function RemoteControl_SimulationFinished()
+ G# a4 M/ {: Q{ 9 @; B8 j6 L9 L% w" o+ f! d) t4 D
WScript.Echo("Simulation Finished!"); |