Example of a JScript
8 n5 N! \) @ D- ivar vbOKCancel = 1; " X* }* _3 e+ m
var vbCancel = 2;
, R! Z: u" }$ O4 dvar vbInformation = 64;
4 S, K9 q: E2 _3 y9 _var Finished=false; ! c5 h0 l+ ]# C, B% C3 x& P
' Q/ l6 @+ ^. r' j: S; y# [
var WSHShell = new ActiveXObject("WScript.Shell"); 8 J4 w& r2 ~4 y( f( D
# [+ S! h4 a: v+ {0 F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& t! Y- _% H1 [( r. m5 I9 V
% g; \& C0 x2 Usimple.SetLicenseType("Runtime"); 2 Z# V' `2 f! n/ a+ v
2 G: g Y x7 }
try % w( E( R; x6 f0 H# @
{
; s( k; g( U4 [4 F; C // Enter the path to a model file!
" J/ F" s7 x o: m0 X5 {, L5 s+ C- L simple.LoadModel("C:\\Models\\Test.spp"); , ?5 R4 }+ A, |; |$ i- e8 Q
}
/ t5 V7 X1 L. h- B T! {$ N9 Acatch (e)
A3 S( ?* @- i' X5 s# |( B4 V% r{
I$ ?0 _1 \8 u6 _& n8 ^( t" m WScript.Echo("Could not load Model!"); 5 R1 `, o4 @+ }" M$ _: @ M
WScript.Quit(); 2 C; I$ S! Q& G, _ F3 ?
}
Z# S ~; `/ E( g8 X! R( @4 E
+ o( H. B9 P$ P" |try $ v! l y. D7 p, p2 U* h6 V+ I n3 n8 J
{ 5 E3 ^/ v0 z+ m4 O; e& q) Z, h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 G9 u* T4 q2 z. T O. L# h! ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 l3 U# o6 @2 ]! f# c; W) M0 e; G if (r == vbCancel)
4 d: t- J; H+ p {
$ O1 ~4 i) [# [* J! E. @) ?! Y/ { simple.CloseModel(); 4 Z: b2 n# o. G
WScript.Quit();
% V M" H. }+ I+ W+ c- O/ a6 z }
! n( H) e y, @, p2 {/ I}
! D0 l, o4 e' k) f2 t, x1 c
F' S% o: G# ^5 Jsimple.StartSimulation(".Models.Frame.EventController"); 9 s1 d: _; u; b& i; s
% o- Y( k+ G6 P" ]3 O, j; T4 @: ~if (simple.IsSimulationRunning()) 5 z" Z4 A( f- K6 i
WScript.Echo("Simulation is running!"); 4 e) u" b2 ~; I8 w& i
: x |& |7 c& l( [// Wait until simulation is finished
( V" w. l7 j' g, v2 e+ K- a' Owhile (!Finished) WScript.Sleep(2000); - ?) w# }0 e$ ^2 M6 N" [; v6 I( R
9 {7 E! j- S+ g3 T/ l8 `
simple.CloseModel();
/ d- h( \) _; |* B/ Lsimple.Quit(); $ [: y. i6 J- c$ E7 M) O' j
WScript.Quit(); F/ u, N/ {3 S8 A
4 N4 ~- j# m3 _ I( B z
) A* {- y& w0 r, q: T$ o+ W0 {function RemoteControl_SimulationFinished() ! O! N1 Z h- {" V( T
{
% q) i7 T7 R3 i, ? WScript.Echo("Simulation Finished!"); |