Example of a JScript
* Q. ` J& a* r% Avar vbOKCancel = 1; . I( T' j8 M* S1 {
var vbCancel = 2; 2 x& v' ~6 {8 \- F
var vbInformation = 64;
+ @0 k2 m4 ?" ~0 L# ?var Finished=false;
; ]5 {6 c3 e- m- } + r R+ A* P! `1 S' r0 `( Q
var WSHShell = new ActiveXObject("WScript.Shell"); 5 [% m5 ~ ?" R
0 M6 u8 i. s" V! n; ^/ A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / v5 k, p3 |! p& u N# S/ \: ?
% \, T6 X* {- n. H4 ssimple.SetLicenseType("Runtime");
$ y% l1 Q9 ~) S
8 B) d9 X/ l* i, g! Rtry
1 N3 W8 J7 ~8 t8 D3 z6 e# w0 Q8 {{ # \6 y- T! ]* I/ n8 b5 U* B
// Enter the path to a model file! ! P1 n; A5 g3 L0 U- f( V- Y; N0 N4 L: ]
simple.LoadModel("C:\\Models\\Test.spp");
0 o* U o1 }. ]7 |- I% x$ \} & k2 `' w" V7 h: L2 _: C
catch (e)
& n7 V5 @- k1 _{
; P( Z; j6 v d4 `' s WScript.Echo("Could not load Model!");
2 {2 u( }8 W1 }9 R WScript.Quit(); 9 a1 c1 U3 [$ N8 N: K# a) J; [" Y
} 5 V4 e k- H( _- U! ^
+ Q, b- l7 s( O( M* K8 Q* Itry
7 t9 \" L- F+ z4 }* ^- d! `{ 3 |8 i8 E, s5 E/ D( D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ J* a0 I3 H- k' T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 ]* v& T6 Z Z0 N' X/ g1 A3 a if (r == vbCancel) 2 m9 ?: P# |/ W9 K) a) p% q
{ j4 G! o2 B7 n* b- l4 d
simple.CloseModel(); 3 B; L% b2 q5 i5 s, w- C- q' S/ Y' h
WScript.Quit();
% S- x2 ]7 t" b4 i& _5 ` } / U* m9 U: i7 G$ S4 O
}
! H. o9 o; O1 o
- o$ M& H: k S1 C8 c7 msimple.StartSimulation(".Models.Frame.EventController"); ' J. E v. l) Z8 A5 n0 O" m
( X7 L# u4 r& K/ f* q
if (simple.IsSimulationRunning()) 6 ]! c+ v' d9 {9 Y
WScript.Echo("Simulation is running!");
5 l4 {# S" |$ `2 [ 4 E% y* u C2 ~7 p# V8 N/ ?& n
// Wait until simulation is finished " V# W; X$ s* ?# K7 D. b& e
while (!Finished) WScript.Sleep(2000);
3 j7 X7 ~2 _+ \: e4 ?
2 y& V( p& f+ Ssimple.CloseModel(); & s! h- U8 J2 E0 S; @* i
simple.Quit(); & q2 D4 a- ]4 l- q) C# @; U' ~' {
WScript.Quit();
7 b2 P, P7 }: a$ ~
2 }- s% g7 Q7 H! ~$ h8 ^
/ Y9 s. K9 z" H$ C9 R' Vfunction RemoteControl_SimulationFinished()
0 P0 ` c0 i, f- P. i% N{
' A; m+ n: \8 D# ?& |$ E1 E$ d+ U WScript.Echo("Simulation Finished!"); |