Example of a JScript
" }' Z8 w$ x: j# E |( F1 T% H# lvar vbOKCancel = 1; 6 _6 }% m- ? O
var vbCancel = 2;
+ ?* w9 r) W* L! Bvar vbInformation = 64; ) b" C( s ^' N( l
var Finished=false;
! p, C" c2 f$ v" t+ Y # b6 v: k) f7 g6 y' k3 c8 Z
var WSHShell = new ActiveXObject("WScript.Shell");
4 |* Z/ F: R4 u. \
8 Z1 w3 _: f& evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 K1 g0 X S# p4 c: `
V2 t/ Z' l1 p/ E v8 C! e ]
simple.SetLicenseType("Runtime");
4 F7 B2 g5 H0 B( X% ^1 r6 H
7 P* l( M* G7 G1 N7 G. dtry
( Y. k( c# |3 n2 d{
: {: r) B9 p Q! x0 C // Enter the path to a model file!
) s; \6 ~0 [% H! E2 k6 c+ }2 q! r simple.LoadModel("C:\\Models\\Test.spp");
, w* g: \9 t6 n; @3 x# t+ k' X} % I* x s, I4 I
catch (e) . m+ I" M# d R3 M1 w9 @% l" ]! r
{
) O/ a6 N" L% c& Q WScript.Echo("Could not load Model!");
. G4 O I3 L; S; }$ T1 f WScript.Quit();
. ~% q" u$ E: U4 Y, A}
; A: G: w: }& O& x6 }4 v: l; c; c8 n6 p " }9 O5 n" L2 g# s) H/ l
try
/ i9 [4 F2 k2 E- O: ?" i/ a{
, T. [0 ~7 c4 Z7 U( M3 b" R) A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 O6 ^! v t' x. K# w
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' p! q6 W/ z V9 U
if (r == vbCancel) ) v0 K5 n% [6 ] o; ^2 d1 _& Z8 f
{ 5 c( B, q5 g& r9 G
simple.CloseModel(); . \4 l/ [4 F+ F4 w+ _$ Y6 d
WScript.Quit();
+ i% ?& a/ t- g: M/ O6 r4 j# Q }
/ W& H! W: S! A+ f- g4 p( H' F}
$ K2 d9 S; ]' K8 T) b5 ^
8 m. A' q; K7 |) P* jsimple.StartSimulation(".Models.Frame.EventController");
0 \. a3 @" ~' N5 w
9 C2 ?" e* e, ^1 n& y/ }0 E9 h+ H/ nif (simple.IsSimulationRunning())
( E# c4 C- I- B% D WScript.Echo("Simulation is running!"); 2 B7 b9 |6 R. G
2 ^7 d" `4 C/ |' f/ X0 g% ~// Wait until simulation is finished # b8 m* H; ~$ n ~ L3 q+ d
while (!Finished) WScript.Sleep(2000);
* W' W" N0 m9 x; e: n
" N8 X( q8 W3 m3 _6 }simple.CloseModel();
s4 z' o$ O# m- z- n! k) X9 b1 Ksimple.Quit();
$ m: a5 ?6 I$ C# P' n: {2 GWScript.Quit();
$ H' O1 q6 P$ j6 H . N1 y! }& G$ T. M, d
- a8 f- L7 Y- {0 L9 N$ a7 q/ Jfunction RemoteControl_SimulationFinished() & R0 r( v) h, K. C q. s2 K2 L' L
{ J$ F3 n3 v* Y
WScript.Echo("Simulation Finished!"); |