Example of a JScript 1 c5 A4 X+ @1 T7 g# _$ [
var vbOKCancel = 1; 9 t/ o- D) t& w) Y
var vbCancel = 2;
( B% x# \0 R& j1 y# c- @var vbInformation = 64;
# [2 K3 t& V9 I2 jvar Finished=false;
; k8 P# H) F' d3 Q& @
- I# l9 U h: u N# N; K# u$ Qvar WSHShell = new ActiveXObject("WScript.Shell"); ; |0 a1 L9 d- Z
* `$ ^4 L- e- R! q: q' Fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% V8 D8 C6 n' ^ 1 ~6 A( N8 K/ _ A; J0 F7 o
simple.SetLicenseType("Runtime"); + U& t" Q2 W" \# `$ t8 W8 X
# t+ D& U! K6 h2 P
try
/ U1 Z1 y, b1 C( |2 y4 o S5 S0 R{
7 K: z; M1 g0 V6 P9 a4 L* o // Enter the path to a model file! / `. C) i7 [! N4 x3 U3 k. u
simple.LoadModel("C:\\Models\\Test.spp"); 5 i; i: ~0 r" W }
} 4 Y, ~5 G5 t1 V
catch (e)
, I( |- G8 x6 Z9 Y/ C6 _* a{
1 n" O0 H5 F t. ] WScript.Echo("Could not load Model!");
8 \5 H1 r* _0 s" k6 d WScript.Quit();
8 g2 B# n8 b+ |/ U o+ n6 E; R}
$ b, \: J) m- ?4 E: H$ |: V 1 T$ z9 c8 h" \/ u3 D) y
try
6 L- O0 w: g( X0 ~& ], O* x* Y2 n{
1 l9 @4 ?' W# r: Q, x8 n& [2 M# E+ N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& o) D! D, \ _: y. ~% I( `, p! C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , R" D$ _! l2 l" e1 I3 S. a' P- r
if (r == vbCancel) & l& @4 U( ]( q1 f, U
{ 3 ?4 b2 k" ~4 a2 ~
simple.CloseModel();
$ |3 x# x# T j( R WScript.Quit();
2 j4 {* j! P# J: _/ n }
& }2 a/ _! M% R. ^: c/ S7 ?} 2 K7 h. l& g. S: B6 B
. L" l9 q+ v7 W# {0 l
simple.StartSimulation(".Models.Frame.EventController");
. j- _$ ]8 e: Q; k. f% f
9 Y! Z% x- ]- h) W! Z+ X0 B" f0 Bif (simple.IsSimulationRunning()) , ?' F* j& _ K
WScript.Echo("Simulation is running!");
7 M& V) ?0 l) _5 Q4 E8 v4 I 1 Q: e2 a; a/ b( X' z2 e( j) L( [ T
// Wait until simulation is finished
0 g2 F$ i& u6 y- Y6 }+ Iwhile (!Finished) WScript.Sleep(2000); ; n: W; {0 c- n1 F" w: q7 w
! } F# }+ J, V- ^simple.CloseModel();
+ ^! |# f; `) K( O5 Asimple.Quit(); u( D8 N7 Y& ?0 Q$ m0 g% y: i8 d! t
WScript.Quit(); + B- `$ N+ Z. w6 w
7 F2 Z( d3 R2 |- a k, A4 K/ D
9 x' V1 G8 W# z- Sfunction RemoteControl_SimulationFinished() L [# d; ~: T- |7 {$ L
{
$ i& |6 T* p# o6 v! A5 T WScript.Echo("Simulation Finished!"); |