Example of a JScript
* [0 k# q- p+ A3 w! ?& @* ~, Lvar vbOKCancel = 1;
3 r. U! ]2 D. t; R( Q& ?. Y: g9 x0 U* Hvar vbCancel = 2; - ~+ ~. v6 o* G/ }/ O; |: y7 ~
var vbInformation = 64;
( X8 K8 A4 J$ S( s. X. d2 Tvar Finished=false;
, U# g2 v5 e7 X9 ?. F + \$ w3 {+ i& l$ T
var WSHShell = new ActiveXObject("WScript.Shell"); ; n, {- d# }' ?" Z
$ h# G9 w# o( @! Z$ P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 ^2 v+ p# F4 r' W7 J
K8 f8 b- I3 S$ q* k# q% Y4 w
simple.SetLicenseType("Runtime"); 4 T# n. ~2 D% t) G+ j4 d# n* U: b
' @) _; ?8 @) S# e$ Z8 [
try % U) V( q0 `% m& Q0 ]& w
{
* D7 O; I5 u$ O, g% W // Enter the path to a model file!
" F/ `# d0 @! `+ H1 A, z simple.LoadModel("C:\\Models\\Test.spp"); 3 b* @4 M' {9 j2 G5 _' U4 ]
}
. ]7 k2 V( G2 w" D' T5 Acatch (e) 9 m2 w7 V* F2 b1 G0 O, t# `* G9 g
{ 4 n( f7 @( N/ s& F% h8 V* s
WScript.Echo("Could not load Model!");
. e* N- w8 d" a, X# ^5 z WScript.Quit(); 1 ]* _4 v- z5 M9 @: ^
}
! ?* Y+ B% ]) a- R j
' {) q% P: Z5 k' ntry . C( Q" @8 n4 I: f, r+ a$ W
{ . }* [ C2 |6 c Y, z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 ~7 d5 @; ?: f/ Y: ]: C$ U3 n( g9 m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. n- N |- p; I ~7 j if (r == vbCancel)
1 k7 G4 h8 L& Y1 i {
1 s: r" ?9 @ Z) K3 h simple.CloseModel();
, G; ~. _; Q$ W7 h- m WScript.Quit();
2 r: ]9 h* C9 m" Q! A% V8 s } 2 h. ]3 |$ ~6 U* b' Y/ C
}
9 C- @( Q" o% k1 }* M9 W
) t( e, K1 f) F% lsimple.StartSimulation(".Models.Frame.EventController"); - R5 G9 D x4 o
/ J; B- t. R% Y) }! ?* {9 m3 g. N3 u
if (simple.IsSimulationRunning())
# z$ w* U A/ Q0 Q- O$ O# Q WScript.Echo("Simulation is running!"); # h- F" C7 H% k4 V
: l2 J1 |1 i5 j3 k, T
// Wait until simulation is finished
; E- b6 x o/ _8 Nwhile (!Finished) WScript.Sleep(2000);
9 ]9 c7 B" k4 I& v; I! T: u; ~
" b2 S( j g( t+ s7 \simple.CloseModel();
& S; m% A% f% Y/ s8 @5 D) ksimple.Quit();
6 D' F8 T) I( q' w9 s& j% A) TWScript.Quit(); % D! o4 @" i; G
3 m8 b! M" F/ Z) Y
1 j2 r/ N9 c( \function RemoteControl_SimulationFinished() & B; f. {/ C" ~( P3 Z
{
8 K6 d5 \4 g1 [" Z9 L* B+ l WScript.Echo("Simulation Finished!"); |