Example of a JScript ) r w2 I0 \; m2 Y, [& v: ~
var vbOKCancel = 1; - n+ j% Z( j" m, x j/ Q: p* t( q
var vbCancel = 2;
" i8 R7 a6 h+ Z0 W# Rvar vbInformation = 64; 2 l9 b! r ~: r
var Finished=false;
% |" t+ q& U& C7 k: c" \
2 [5 b7 P+ r d: Q$ e8 x' Dvar WSHShell = new ActiveXObject("WScript.Shell");
% p- \: N4 O! o+ ]0 W, u5 O$ I
; g/ j# `4 W5 t$ r3 h6 Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 p `- y8 w# _+ ^! I) F' d ; D! M7 ]9 t7 g0 J# z- ^7 a
simple.SetLicenseType("Runtime");
, |& ~% r6 \7 l2 I- L' T5 n, d
) T4 p$ e# S+ t3 R" W) ~try
0 h T& v* z+ p! }6 m; L{ 3 d# t1 b) t3 M7 C, C2 Y: a
// Enter the path to a model file!
# k) i2 h" Q& U \ simple.LoadModel("C:\\Models\\Test.spp");
. Z6 w6 K& `! }" c, X6 |* C8 R5 C} * y0 ~ F0 i% M2 w |+ N ]# o
catch (e)
: d! g2 m( f0 x7 Y. j: A{
* R2 T1 O3 o3 {. r* Q WScript.Echo("Could not load Model!");
2 ?7 c0 j, P& V; n6 n4 ~ ^9 R+ I0 f WScript.Quit(); ' \8 b5 Y/ }8 U T
}
' x! {6 O$ `0 K+ e: k, ]* E1 K
6 h) g0 p+ g( w) _try " ?; I" `1 H) X0 V; Q
{ ( W2 g9 p( _% W* a' t
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 \, Z* r6 D; \" {3 @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" Y* B) d" J' y if (r == vbCancel)
6 D# ]) _2 P$ G {
8 I& S2 M! T5 \* D5 E K3 y simple.CloseModel(); 2 ^2 {# K$ u) e; x
WScript.Quit(); / w6 Z9 H! E1 W! y' s) o
} % ?6 x: r3 \* G/ ]
} 2 h; W" {1 j! w! L& u- |" I
3 \, ^0 L' v( R E1 o1 K- ~
simple.StartSimulation(".Models.Frame.EventController"); 4 A& y' V+ k" F9 h$ v' h
, I5 D- q' y# X- y
if (simple.IsSimulationRunning()) ( Y* W% E# G( N3 D
WScript.Echo("Simulation is running!"); ( ^4 I6 {& p8 a# V3 K+ ^
$ g( u$ e" U) l// Wait until simulation is finished 3 i- l8 N9 z7 K9 j! `1 B2 d
while (!Finished) WScript.Sleep(2000); 3 E( q7 }; x" u7 M2 ~
0 G, |/ u+ r7 O
simple.CloseModel();
9 {2 Q0 v5 m! u9 ?simple.Quit();
* Q1 c2 }6 |: l5 @ LWScript.Quit();
3 ^2 C. l4 P/ C/ c. U
* Z" J( G9 E# ], I ; i" o* ?9 E" E/ Y
function RemoteControl_SimulationFinished() - G n8 h$ m2 V" n! o
{
8 M! w9 c, o9 B1 j. B: y, |0 D: m WScript.Echo("Simulation Finished!"); |