Example of a JScript 1 X. _$ X' {9 E2 R2 Q1 d- P& \
var vbOKCancel = 1;
+ `; Y2 }; v) U- Lvar vbCancel = 2;
+ S' G7 w, @+ Zvar vbInformation = 64; 9 p* K% p. g* }/ @" ~
var Finished=false;
! }# q' U5 u) ?. c2 A$ a + T- [1 R- L. E: ^8 G4 X6 W2 R
var WSHShell = new ActiveXObject("WScript.Shell"); ' G- l- }1 ?/ L7 R+ y
# {) O. p/ R$ a2 M$ U O0 }8 [
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 s" `) P" t# w X, q 7 ~6 \2 t- z8 @: A
simple.SetLicenseType("Runtime"); 8 H+ p" m$ v* l% Q
; g$ Q6 ]1 O+ V
try / @" f$ [! v' _; V$ g
{ * I. o5 X! c9 X4 a' B
// Enter the path to a model file!
+ ~7 {( h) o* t P- ?; t simple.LoadModel("C:\\Models\\Test.spp"); # S; y6 s, p. P( Y. O Z+ s
}
+ Y$ U- @* p: N7 m2 |catch (e) ) O0 S! z' S2 {$ m# Z6 }. c1 Z
{ . g( ?" w- w4 o) |8 ?0 W9 a+ ^8 ~& t6 _
WScript.Echo("Could not load Model!");
8 |/ }; }, L2 e" \3 n WScript.Quit(); 2 B0 f- z( h& `4 r4 l `
}
" |$ @3 }* k _# k
0 H* \9 j3 j* i& Ytry
% C( c+ Y& E6 m d- A& d{ 4 e, l4 P, @) i j9 X5 e# W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: K; I6 J1 U( A1 N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " ]' {2 W. x( q6 \) Z
if (r == vbCancel)
0 d k# N+ A4 h5 o! g! V {
8 J, V1 ^. X% ]: @/ [, u K2 s simple.CloseModel();
1 B7 |# G4 l% q$ Y WScript.Quit(); 8 u0 L8 w K" g) W( ]
}
' b6 F6 I2 O+ e4 j% L} % _3 h, b& V! S" [6 \
- \2 W, u4 M' g+ s/ K7 csimple.StartSimulation(".Models.Frame.EventController"); " I2 n. e% |# \: o7 u; J
2 }, O9 U) R" G; \6 t! j$ a8 A7 V
if (simple.IsSimulationRunning()) ( ^' j. M, ]3 ~8 @2 ?8 s3 M
WScript.Echo("Simulation is running!");
. @7 Z" p* U2 l- E- q! _' X
2 V# `1 j1 x7 t0 [+ \+ Z// Wait until simulation is finished $ M( \0 n6 h( ~
while (!Finished) WScript.Sleep(2000); 8 y* J9 Z* q: C" @; A- y
* t' m2 l* }# H+ ?simple.CloseModel(); 8 v! a3 c7 }5 o
simple.Quit();
- e# {& X, N. V4 t$ zWScript.Quit(); - @; o2 k+ y3 F6 L6 {
1 Y9 l1 P1 b* s$ r' d
- \6 F; g, k6 o( @3 E! |0 E) L
function RemoteControl_SimulationFinished()
" e: `1 \/ f" L# N/ @6 Q{
; H& Z% B5 v8 _# m% | WScript.Echo("Simulation Finished!"); |