Example of a JScript
+ q3 q9 K, o2 e3 Q0 |% J; rvar vbOKCancel = 1; 6 x- Z1 i4 T$ [3 G' ^5 x/ `! J$ u! s! D
var vbCancel = 2;
3 w$ O/ _* {" Y* u* J, s( cvar vbInformation = 64; " s l5 X9 e P* U
var Finished=false; 6 x6 A; _$ K/ v; T0 d6 n
5 C- {& O% {+ V5 dvar WSHShell = new ActiveXObject("WScript.Shell");
6 V* `- {& p @# Z3 j T) d! B) [0 \ : V8 J: V; L- g- L& D! b4 o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 {3 A2 }, \+ J/ G- s: V) i0 Q 6 I) X! X- k9 ~0 u' M$ g
simple.SetLicenseType("Runtime");
/ l6 [! g' U7 A# U: j0 ~; S6 p + H4 t, x' s7 [& R% p: A
try : Z% F) o2 ?3 ]
{ & I" j1 [% b. B0 `
// Enter the path to a model file!
6 E, b8 V- |* { simple.LoadModel("C:\\Models\\Test.spp"); : Q; r' S* K6 p5 Y7 z
} & I6 L, @ V2 s/ x
catch (e)
8 Q, v$ d) H; h' Y9 X{
# X1 s) P$ c+ q; j4 N WScript.Echo("Could not load Model!");
6 ^* Z& x2 Y( x! @: J WScript.Quit(); 1 ~* t; I& q/ q: }- F) l# t
} / s) C) W5 c( O% s1 G
- a+ Q8 }0 b6 t: l* J$ R2 Q. B8 p
try , R/ \0 k3 s- o6 F7 v7 a n {
{ 3 j* f, z. x/ n6 X+ G# h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # B, A- F" U, N, @1 t
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 a* C% @0 L: }5 x if (r == vbCancel) 3 O* v/ Z! U( u$ @% y3 N. i. r: P
{
$ _8 @; ~% A* ^3 _ simple.CloseModel(); : g6 ~0 Z+ K2 U$ E
WScript.Quit(); ' v0 I# z% z# ]' |0 ]5 G$ A
}
* |2 u7 x: Z, a" ]& @( F}
# |0 ]6 R' C8 y4 l1 H * c' g- Z8 h. p! R8 v' B
simple.StartSimulation(".Models.Frame.EventController"); 3 Q5 l% C& @" t: A4 j; t- o
, ]# H3 L1 D0 m% y2 }7 l2 ~- j+ @# Lif (simple.IsSimulationRunning()) c* e) \0 }+ N2 A% z
WScript.Echo("Simulation is running!"); ; v2 }6 \4 e# v
5 b3 \/ L! D- k4 w- W
// Wait until simulation is finished ) J8 D/ {% u& W3 p
while (!Finished) WScript.Sleep(2000);
, z' D0 K* g4 a+ c- d% c0 F/ \ 2 @1 ^: X I5 F, x
simple.CloseModel();
% F5 M1 g$ Y* @2 |" msimple.Quit();
. t" ]6 W" ^7 M4 ?WScript.Quit();
( A( P$ T3 R* j
9 |) [9 Y1 i Z) u* Z
. g0 v) E* G3 i; n& Q6 ^, Ufunction RemoteControl_SimulationFinished()
+ @/ D" O. \8 z' Z. X: h! s' X{ 1 q- k8 D& ?2 O( T# `" \4 j1 Y
WScript.Echo("Simulation Finished!"); |