Example of a JScript
" K/ r/ q/ C/ \( Qvar vbOKCancel = 1;
, D# ~! o; c2 U0 xvar vbCancel = 2; 5 k# b2 i2 a2 L/ N; Q$ o8 \, {
var vbInformation = 64; 0 T* k/ n$ E w. \& a8 j+ W1 T6 c% p
var Finished=false;
4 Z+ D M! K8 ? Y* | N& e) G 3 p/ f4 Y( K# y; i( ^% ]3 L
var WSHShell = new ActiveXObject("WScript.Shell");
$ n# K1 H8 O2 a9 l) m+ A7 z( Y
* o! p$ @) U$ I* k% O" J0 P1 Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: C W5 c, P7 s5 K: j/ \ ; y; v; Q# o. B# }- q
simple.SetLicenseType("Runtime");
4 h/ ?& Q- o# a: W; U$ Q 9 R( g. r, p! u" e
try $ n+ C' W# \5 e% u
{
( `9 i- k1 O# q: p+ Z. `9 Z# x* F // Enter the path to a model file! . P `6 k) Y6 k3 s8 @. g" ?- a# L
simple.LoadModel("C:\\Models\\Test.spp"); 5 m+ w# W$ |9 R% z. e
} $ f9 g. B) [4 D2 p4 n
catch (e) % {9 P: o9 m, I# R4 {* W
{ ) M* r+ F' m% E7 A& ?1 O
WScript.Echo("Could not load Model!");
, P' X5 ?# v& X4 ]3 \* _$ { WScript.Quit();
9 a( g- |- A' I* ?. M5 O}
5 z( U8 e4 ~* c8 h6 f9 s0 ^
$ H2 c, P0 f6 i# Ltry
2 r& n% k* l: r{ % i4 L: Z! u1 v# R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 X% d L }! U7 F" _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 {0 E: ?" T7 N1 t& ?% Y
if (r == vbCancel) 7 I9 a% f/ W1 q0 W6 c/ V: b
{ * X9 d6 I* L+ Q( N. W/ _
simple.CloseModel(); 9 ~* _) _8 |: z- G
WScript.Quit();
$ ]5 b; ?; O3 U5 e o1 Z+ D2 h } ( j. P9 M+ D6 w0 [& y0 g; W
}
. o* z" ?* G( X . r5 Q8 m4 A4 ?5 ]0 k* }
simple.StartSimulation(".Models.Frame.EventController");
2 T3 i) E, M1 k3 w; a" V) a
7 \. N2 h( U- q$ k d, Q3 Eif (simple.IsSimulationRunning()) % o- E6 E) F1 W+ x- z$ L
WScript.Echo("Simulation is running!"); ! M: Y! U9 Q) f
& [: o: q( D F- Z0 [/ o// Wait until simulation is finished
: c7 l$ ]9 R/ d' b, E1 i/ Ywhile (!Finished) WScript.Sleep(2000); " s' m }& L, ]0 H/ a3 y' D0 q
7 ^7 B9 `: [8 ]! s: F4 ~
simple.CloseModel();
3 B6 ^: B/ R; J5 w5 J' F0 jsimple.Quit(); ! s& k) Q- m6 x; |
WScript.Quit();
0 P/ ~8 _5 B( ]$ k3 t
" w) u, X+ k- { , ?& N+ ~# P- R% B
function RemoteControl_SimulationFinished() : Z' V$ N/ {6 u0 Q$ a
{
) s5 }1 D; Y+ X# {8 a& u WScript.Echo("Simulation Finished!"); |