Example of a JScript
* m! o9 D% ^# e: G6 vvar vbOKCancel = 1;
/ t2 U+ K6 z# Z1 j9 n' r& Tvar vbCancel = 2;
( f* t4 m* L* m# `' D; _var vbInformation = 64; # F( u9 u( {( c. ]3 c6 L
var Finished=false; / z4 ~5 [) t+ Z) {7 J1 D9 G2 a
1 a c `. q; [
var WSHShell = new ActiveXObject("WScript.Shell"); 0 a9 t/ Z" b' z7 q9 B+ E- c, b4 d
! N, Z+ E! {8 k) F1 O: C5 |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 H" e% ]/ ?8 e# G! q
- p( B: c |2 m4 s8 o% z0 `7 Osimple.SetLicenseType("Runtime"); * I1 h& a3 m( q2 V4 m
. m4 W* p; Y( @6 z) g+ u7 n! itry
8 |# [! e0 c3 H# r3 {: }{
5 Z u/ I9 ~! l8 o( z // Enter the path to a model file!
# T8 q! \6 B1 U$ A simple.LoadModel("C:\\Models\\Test.spp"); 8 F% i% @7 p$ ~6 E! [1 i& w+ p2 o3 M3 D
}
! N0 D1 @( L( Acatch (e) - A+ n! T8 f S
{
4 @# [5 X0 z6 C* B9 f WScript.Echo("Could not load Model!");
$ F, d' W; v1 a( S+ z; {4 ^5 Q WScript.Quit(); h3 S6 W2 d5 b% B! b
}
$ @$ G F8 E6 D$ P7 A . d7 ~- Q5 m* R w
try % T4 S. V1 f( y8 K& |7 w; A1 V, y
{ 7 V& E0 _1 l/ d( Z& r7 J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . a1 J5 V8 s2 r3 a( N1 |9 P+ D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 ^/ c# _" k$ m, ?; @ if (r == vbCancel)
& j% X) P W. b5 \ { 0 `! V6 f* e& M4 I2 F9 T6 Z
simple.CloseModel(); 5 U! O8 _/ f# U) @& W& I+ j- A5 U( z, S( k
WScript.Quit();
" j3 U0 [8 u9 C }
( h; x* w8 s2 S2 o+ J. r}
~2 Y: O- V N9 I# C8 s : K9 T) `8 h$ ?9 h+ ]( i5 I' Y
simple.StartSimulation(".Models.Frame.EventController");
# B {' s {3 e: L5 d# y) g$ v4 ~ ; ^) _2 S) h% ]9 I
if (simple.IsSimulationRunning())
. ?0 S) L0 D: J& a( C4 m3 m WScript.Echo("Simulation is running!"); ( o% P& O: e/ M8 i8 o0 Z* J
. t8 o( t! P" V/ p+ g/ U
// Wait until simulation is finished 9 u4 f$ m e2 t
while (!Finished) WScript.Sleep(2000); 6 S3 W/ |# c- g ~4 h, s) E' z
, e9 H2 E) x7 f7 H1 k" Isimple.CloseModel(); ) Y+ b" D* z3 a6 k- z$ q
simple.Quit(); * G" H) |( g3 r! T1 Y! p" @
WScript.Quit(); ( N, S' h: B$ ~( R7 U; I
N- d( x9 U, i& D6 i 3 x( b5 p- |) r
function RemoteControl_SimulationFinished() ) [7 X) K! i5 `/ T0 Q' I- V1 t+ {
{
7 {! ]/ Y0 Y9 Q- g WScript.Echo("Simulation Finished!"); |