Example of a JScript
! t6 W% ?7 d9 m7 N1 s- t( v! L* u" Fvar vbOKCancel = 1;
- P3 r' ]0 H7 m: H2 E" \/ Nvar vbCancel = 2; 9 l4 R, w# r. g6 B& ~
var vbInformation = 64; # V% C+ L$ r2 t) [
var Finished=false; 0 ?4 Y& y, S: b0 p, ^" d( m$ t
. ^; z# B; C$ F& dvar WSHShell = new ActiveXObject("WScript.Shell");
0 {) B5 r3 n. n I5 q0 C; A
6 Z& r4 A. D qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 l8 g" C' l2 u3 e9 Q: x8 u - v0 s* f7 J2 w; d: A
simple.SetLicenseType("Runtime");
5 y+ e% O+ \, {3 b: V
& q5 v- Z# W1 Stry
. V2 Q8 A6 m# U4 e. k& S2 ?# B{ & N2 F/ Z$ a+ C; ?" Q0 `
// Enter the path to a model file!
# V# ~4 {! ~. A' G6 g; z s. T' Y: ` simple.LoadModel("C:\\Models\\Test.spp"); / `2 u' J# C% X. \
} " G' ^( _5 P5 i3 ~2 d7 S
catch (e) 9 C% m; g! A$ L# X
{
3 A+ S, _3 [4 v WScript.Echo("Could not load Model!");
% | w) R' r2 g5 [ WScript.Quit();
* g U$ H9 c, [1 q5 p" M}
; }# G( K. d2 T: s
" \4 M; g9 S. ktry
2 b& ?9 t/ r6 L5 e8 h b0 [{
. n1 \: V1 e. n+ Q, y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / C8 d; F5 H, Q! M& ~9 s9 p
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ G8 N; u+ _+ U6 B- E4 h if (r == vbCancel) 3 Q* m1 c U, P
{ 8 s" Y: G$ |5 b9 V% [
simple.CloseModel(); 3 |" }4 V3 H' w* D. i, c/ b& n
WScript.Quit(); . d$ y4 p0 [6 l1 W
} * p# b. a. b% h
} 0 D. z4 u- S& U! @; m2 ^: |
: g5 i4 G U% n, m0 [simple.StartSimulation(".Models.Frame.EventController"); 0 I% |. r' I9 m. Q
3 x" p+ a% z! V4 ]% Uif (simple.IsSimulationRunning())
; \+ Y9 B* A; q+ A, g WScript.Echo("Simulation is running!"); ; `0 v" _' `( a7 o
- p3 Q" M0 b/ H& d- \( b// Wait until simulation is finished 6 Y* ~. f% g! ^7 F
while (!Finished) WScript.Sleep(2000); ) N3 ?! w+ {; f7 W. {7 G' @
# t) }2 t, y- Csimple.CloseModel(); 1 [ q8 \9 h: b; `4 ^1 H/ y* T
simple.Quit(); 1 x. C1 q! J2 K- d0 Y' v
WScript.Quit(); & o F( g9 k8 F9 H H& S
( L: o0 f6 q8 D& T; y$ A - ?# s! A: ~" l1 a
function RemoteControl_SimulationFinished()
. M: H: a2 [% X. V j& r/ F, i, X{ ! L0 X L& C5 A- Y, Q
WScript.Echo("Simulation Finished!"); |