Example of a JScript
& D, u$ T7 i* Q3 V; c" u Xvar vbOKCancel = 1; 6 m5 s( T5 r; M4 j' r! H9 ^ N
var vbCancel = 2;
9 T. M0 q4 z9 N+ A, l6 v/ ]var vbInformation = 64;
6 {. e2 h% C+ e+ ]6 I8 T u( Avar Finished=false;
+ e4 q1 K; f6 A9 v2 E# R, s
. u+ |/ m8 d& X' F2 y- jvar WSHShell = new ActiveXObject("WScript.Shell");
1 e* o" w% {+ o+ L/ c; w( n
! ~* [( X* L# a/ r& yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 p/ ]& h* i" \& z" Y 6 }1 s. `' T) {; \3 }
simple.SetLicenseType("Runtime");
* k7 B4 b! M) ? Z+ z* a
" c5 J! J2 W) f4 M9 g6 F0 ^: c7 x% ptry 9 M% E$ f) s. M2 G1 x
{ $ e" w( ?1 Q# w/ @$ L% i2 {
// Enter the path to a model file! & ]! ]: t, z; [7 Q3 _
simple.LoadModel("C:\\Models\\Test.spp"); ) m, t0 }) p0 {' n G# r
} " l( x) L9 h- J( j5 E: g
catch (e)
* ?8 u# h$ b u! M: @{ ' d; J5 X9 O& c! x! x3 J$ [
WScript.Echo("Could not load Model!");
! r; E( a& ~7 a0 L. P! J WScript.Quit(); $ Q: u8 Z' D" g% n5 T$ i j# Q/ d
}
+ j/ F) O! _: A 9 y6 v2 a2 C. n. b; F
try
* L- w2 V* R& A3 N) [: Q# V{ 5 j9 s, }- K+ L% N" K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 ?0 x Z' A9 w7 P; S8 ^ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; k* q# c- S$ e& f if (r == vbCancel)
2 E! Z# @4 K- V) c6 ^ {
# c& v2 B( L2 q; \0 g- ^ simple.CloseModel();
+ U& L) P$ y% M @* T9 n: M% } WScript.Quit();
0 F) T! ~! o, o% B! w# f }
3 n1 z2 }; b, |: }}
3 U; ~, C+ m6 E' x" t% H
. r7 H" U) ]$ y8 y* ssimple.StartSimulation(".Models.Frame.EventController");
; o2 a% b7 _8 M* m* ] ) G, k8 Q0 B7 K2 P+ I# b* {# @
if (simple.IsSimulationRunning()) : O7 r3 f5 F1 n; c
WScript.Echo("Simulation is running!");
7 J$ w. D0 f$ b# n" D 2 B6 R9 V5 m/ @( c( b f% A
// Wait until simulation is finished
/ c) j. e4 v, nwhile (!Finished) WScript.Sleep(2000); ; b' W' K" I3 r0 }* @
; y5 w4 n6 Z" C% w& { u
simple.CloseModel();
& g' {1 v/ u' o8 Ssimple.Quit();
7 Y. a5 }+ m( W9 |' `" mWScript.Quit(); 7 [7 _: K2 y/ e4 L- ?( o; _
5 z3 [2 O- F5 V, r6 T5 v3 m % t& Z- d# V- L1 h' w6 i
function RemoteControl_SimulationFinished()
w3 e' G3 m) O# q: v3 v x7 S4 l{ % R6 `$ @+ k6 H! {6 {/ N
WScript.Echo("Simulation Finished!"); |