Example of a JScript
# ?% c" y$ h v" S4 d' Avar vbOKCancel = 1;
* N9 B. d. G3 b3 B+ Ivar vbCancel = 2; 4 \" e+ n( w$ m+ L) M
var vbInformation = 64;
* D+ i" G( t* l G* B5 cvar Finished=false;
( j6 @ _; B9 M4 w! g$ L& Z3 S* [
. B' |* j/ I$ P7 z# ?# Nvar WSHShell = new ActiveXObject("WScript.Shell");
+ R1 a' G& h3 \ + @/ L0 J7 |' i: P8 y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( h3 N4 Q; p9 h- }. @
: V5 Z5 `4 [% U: [
simple.SetLicenseType("Runtime");
! l" ~; E9 ?. n n$ p" A
u+ `% N8 G. _4 p. Utry 3 } t; E. Y7 s6 {1 M
{
k3 `# P* V3 s# L0 v _ // Enter the path to a model file! 1 T- S! O g' }: r0 Q
simple.LoadModel("C:\\Models\\Test.spp");
3 ?, |/ s- r# O/ M$ r} : t. c+ d( u7 U+ }
catch (e)
0 }/ I, ?) p/ M7 T( w$ V7 T{
* F, L1 _5 |1 \2 r WScript.Echo("Could not load Model!");
- U# r: ?& g# X* s6 `1 x WScript.Quit();
/ r7 D5 ]) X c' {9 B7 W2 `} $ V8 _8 G, p) x
! L7 ?0 M6 R# r; J7 `; ntry * G% j2 E7 {4 A U7 z p6 b. R, a
{ / ]# l( b% r. z1 y6 K4 {2 F9 M
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, N% W3 `# c$ x+ d. ~" J/ { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & D2 s1 W; k) k" d" J8 d: l& Z
if (r == vbCancel) 8 E4 \* g# B# j& a
{
8 P" k& e' o- V- @7 {. @ simple.CloseModel();
" L) K) E5 R1 D4 t WScript.Quit();
; g% P7 m+ x# J! u6 N } % T7 F1 `) b8 ]" u. g6 m* ]
} ' d; a. m, a3 n8 e7 _7 t8 Z3 [
. v* a5 S% v7 @$ {- ?simple.StartSimulation(".Models.Frame.EventController"); 0 S. U# f1 v# A i" R
+ E" L# ]4 d; U7 ?- n
if (simple.IsSimulationRunning())
* O# u0 E: ^3 c0 U WScript.Echo("Simulation is running!");
* L" o2 S4 H. B# a) ~/ d0 |& f , d1 L9 D( v& O8 ~4 }+ X' M* ?
// Wait until simulation is finished
" h J+ J3 `2 G3 l' Rwhile (!Finished) WScript.Sleep(2000); 8 @/ V v; d$ n- b: {: ]$ n# Z' L
5 y" w: x8 |0 f3 f) {8 t$ Asimple.CloseModel(); 8 }; C- E* ?8 M; G4 W
simple.Quit(); 1 S. ^2 f, I7 s; l2 i
WScript.Quit(); * f3 ]2 E' t+ n4 t5 q& t) A
( J7 m& C, c t" H ; \3 A3 n I: x6 U
function RemoteControl_SimulationFinished() : K0 o" I4 J3 K; s7 D. H/ p# b
{ 7 j# C4 W# U4 \8 Q" Z- t9 P
WScript.Echo("Simulation Finished!"); |