Example of a JScript % c4 B" v9 b* k$ @1 K+ Z0 N
var vbOKCancel = 1;
7 c9 t5 W9 q% z9 k. E+ |1 Mvar vbCancel = 2; 2 @$ @4 E3 D" \$ |9 u1 y
var vbInformation = 64; 2 S8 A0 A. Y1 o" R6 p! N1 X
var Finished=false;
4 A' d( S. B9 X# {+ {# M6 R$ Y/ g 5 k0 b; R! [: t) n4 f9 h
var WSHShell = new ActiveXObject("WScript.Shell");
" X3 L0 i& b4 ]0 K. t. o, ?
`* F* t8 ^/ s3 L0 c: Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. @5 }2 }+ f; h+ J4 I$ j6 a 4 i2 H- V; b& x$ r
simple.SetLicenseType("Runtime");
1 q+ E9 e4 c# M& t
: H( Y" Y# L2 ^8 x( stry 9 k; |$ @. Z/ O, ?( V
{
4 S# d' C3 K [ // Enter the path to a model file!
- {+ P: \8 Q& I S. m2 r8 l simple.LoadModel("C:\\Models\\Test.spp");
% A* H6 Z+ W! n6 ^% H% P' H4 b}
3 w4 i( W8 A! Q# z8 {" e# P$ g2 M: ncatch (e)
# G9 e4 R9 }. f: ^{ " w4 Z( S% l3 `1 f: a
WScript.Echo("Could not load Model!");
" T& T/ S' \1 h. k1 x WScript.Quit(); ! e+ m4 i! r7 X ~; m
}
, d: q- d Q% I! e0 M* L6 K
- g7 t8 N# N* c+ R o, H& btry
; b! R/ f3 H5 a/ f1 J; i{ 8 u( ^+ R; T8 a" L! g/ K7 K3 q' l. u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 K* e8 u6 B ~) M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 F* X+ G" ]3 {7 I if (r == vbCancel)
5 M& d: u1 Q* I6 `3 u8 g { ' b9 ]3 g5 K8 H1 a" K8 c; L
simple.CloseModel();
& H* z* _5 G6 E& Z) V+ z/ l8 d WScript.Quit();
0 F$ u8 }1 M( v) H; l/ @/ L h: C }
+ C9 l+ s( u% F! M$ ?# g u }} ' z: b9 p& G7 I0 P: x
' X7 ?, r2 Z. j6 w4 i
simple.StartSimulation(".Models.Frame.EventController");
, Z/ r/ I( x/ w/ X2 E+ m( O
$ F) U) [5 U: {) sif (simple.IsSimulationRunning()) ( Z0 J |* n2 }- j2 a: f0 C
WScript.Echo("Simulation is running!"); * E9 q/ j% a3 X/ g1 R) ~
0 f+ `8 r9 B2 F4 S$ p# x% w// Wait until simulation is finished
8 x( C4 B4 E { q A/ g# c+ A; cwhile (!Finished) WScript.Sleep(2000); & U8 h$ t& g+ T$ E1 Z5 r
! ~! B4 u5 s8 z4 S s
simple.CloseModel(); . r0 j5 j$ M }$ P9 T4 E) J
simple.Quit();
; \# {" c+ d# i0 Y( eWScript.Quit();
: l4 e5 |: E, L
! ]* A _+ l& T' a5 q8 _
. |' j% m) k8 }7 ifunction RemoteControl_SimulationFinished() ! e$ I1 F! ^% A" r
{
$ I/ u& P, l0 K" {& } WScript.Echo("Simulation Finished!"); |