Example of a JScript ) I/ d0 @# \6 h Z1 P) a) ^
var vbOKCancel = 1;
6 R1 x8 e% e" a0 N, ?1 avar vbCancel = 2;
3 S, G5 p4 v U% wvar vbInformation = 64;
1 K" H7 l# }" Gvar Finished=false;
' ]( Y8 T9 K* ^1 B& W
( D/ I* t% t) s, S' f% Ivar WSHShell = new ActiveXObject("WScript.Shell");
2 V& \' s; i( P+ M * @" F/ d& w1 W, o6 p0 r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- R: V* [% R) U9 a( B; @
3 f+ M: N% P+ s, Q& J( D' tsimple.SetLicenseType("Runtime");
+ s* ^. G2 j) e7 u; K 1 ^ G& S. [" r- Q, B
try
, U; o0 m7 X. Y4 [+ q{ + r/ v$ H) m7 h& a
// Enter the path to a model file! ' |$ W$ o" F2 K7 N5 O. m% b7 \
simple.LoadModel("C:\\Models\\Test.spp");
" _, G' y" r* h} , v+ K9 \0 I+ B
catch (e) 5 P( Q' _) q, s* b* B
{ $ W6 I8 k# ?9 q+ h: |- l
WScript.Echo("Could not load Model!"); + k- D/ S! {9 w% T
WScript.Quit(); 6 w/ A+ Z$ c; c$ K8 v. U. y [
} ! x2 y9 d6 N, j1 m1 k$ n! C
. J( B" A# q) ^4 C2 y
try
1 a; [) n; x+ @: x- C! c. g{ - [' q1 \7 F6 q# w7 w* V5 }& W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% w9 I" p: D& c3 R r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) r+ }9 M9 g7 c# H+ w/ `/ i; i
if (r == vbCancel)
' k3 c; g U7 w& [; C {
8 V+ v9 Z- z2 r simple.CloseModel(); + E5 s- ]! {0 L' D$ U: C
WScript.Quit(); " `" Q! c) L; e* s" } D
}
/ Q; h- V& g6 m9 L3 ?}
# c$ Q, W' m" C6 C
; k9 k' `; N4 j: q3 J1 ^# Csimple.StartSimulation(".Models.Frame.EventController");
3 i, N2 ~" o4 L& p+ n0 z& U* o
V4 m8 p8 A) }" s# q: [* Bif (simple.IsSimulationRunning()) , V& M; `5 ?8 Q4 h( a8 Y5 ~6 s
WScript.Echo("Simulation is running!"); ; N0 i. W, o; S
, l: A" i4 t5 f' B* o0 Z3 N
// Wait until simulation is finished ' S/ i1 O$ F: Y* M
while (!Finished) WScript.Sleep(2000); / P. Y/ Y2 ^3 y6 A ]2 n+ ]
x3 p/ v, S, Y7 Z/ O2 [3 a, J! j/ xsimple.CloseModel(); 3 E+ m0 t% v7 o) a5 g4 i# u# [
simple.Quit(); @& l+ c' z$ o. T. A1 j; x. j
WScript.Quit(); / l3 f- h+ {8 W* J$ W- Y
; A9 m: F/ |" X : o% ~7 A, h' j6 t4 ]/ b9 ]
function RemoteControl_SimulationFinished() 7 }( [* z) E6 ]! F+ E# [: j4 {
{
3 m+ Q2 |# y: j9 ` WScript.Echo("Simulation Finished!"); |