Example of a JScript / N* ` l7 c) u" l7 m( ~
var vbOKCancel = 1; 8 d: Y& `" d& [$ @. [; u& T
var vbCancel = 2;
; ?6 z3 x' U8 b7 S/ A3 k8 xvar vbInformation = 64;
* h* ^; h' ^$ Y) C' F/ h& Nvar Finished=false; / Z' h6 N' b4 O6 ]' o* P' `
1 _- g: g/ i+ {# U7 b9 gvar WSHShell = new ActiveXObject("WScript.Shell"); 9 \! y+ O7 q0 u/ t
% H8 v0 N; E: evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) E% ?/ j5 P$ C0 ], F7 S l0 N& Y% x) N
simple.SetLicenseType("Runtime"); . w! {" x, |( |0 t
/ P* ^/ J6 d/ k3 J9 u- {try ( i5 B- [( o3 C3 o
{ ( t C! e+ n7 O
// Enter the path to a model file!
4 |0 D7 a, I4 V8 f: f6 a/ D% e simple.LoadModel("C:\\Models\\Test.spp");
: h" O0 K7 R; \- J; D3 m/ ~! i}
% K& A6 ?2 P% L$ O+ A& s& Vcatch (e)
# b# O3 r6 v' v! p: [: P# g{
1 ]2 S! i0 u/ [& M5 | WScript.Echo("Could not load Model!");
; A6 o* y! m! ]( m9 ~" q WScript.Quit();
( V( N5 o& k" {. S; A5 p e% ~9 O} ( R5 U2 [0 s2 h! |9 |
0 W7 w& r# P0 n: r/ Ztry
/ a$ Y! |3 J+ u* d5 T6 h9 ^0 Y7 w{
4 C# ^( H& y! H+ P5 H% B0 T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 w3 q9 u9 I7 V# u. d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( P9 a2 j8 g' x6 r* h2 g$ p+ ~' a
if (r == vbCancel) . R/ z4 m3 O$ H$ [7 x" C8 P5 Q' q
{
6 m$ f% F/ ^; } simple.CloseModel(); $ q; r5 m+ _& {( c( J: d
WScript.Quit();
% w$ J" |# X2 `% S7 @" m- p$ L }
6 l; M; U4 j1 L} ' F2 |4 E4 {# ~0 N& l- U
0 {4 g4 |7 } Q5 `( [ csimple.StartSimulation(".Models.Frame.EventController");
Y; U s$ W* U# M4 ]4 O( t
$ ~: y* T5 J3 s: g/ Sif (simple.IsSimulationRunning()) 8 Z8 Y2 a- J9 Q% @# R
WScript.Echo("Simulation is running!"); ( f# N/ @5 I( T
( Q0 t1 X |& I. }) n# C/ U// Wait until simulation is finished
. }9 h$ G6 o2 Q( M+ L' I. h/ G6 Twhile (!Finished) WScript.Sleep(2000); # @; o- P. }& R V2 F: e& B/ d* h
[ n( f9 \5 \' X/ i5 v5 @
simple.CloseModel();
/ d) H8 I' K/ n. j, n2 k7 osimple.Quit();
* R; U4 h: @( J$ Q, {0 f( CWScript.Quit();
/ A4 F4 N# n$ K4 H ! |& D# c' B7 f* v7 l% ^
" J8 I8 k/ S! b! u9 dfunction RemoteControl_SimulationFinished()
7 R1 B; [% L) x$ }5 o! @. J{ ! l+ U, Z! e9 _) [9 v4 J
WScript.Echo("Simulation Finished!"); |