Example of a JScript
" A/ y) z: n- q; x* m! [& hvar vbOKCancel = 1; 5 }; L5 R' q. G" ` L) Y6 d
var vbCancel = 2; 3 ]6 ?) O4 i7 I5 P7 d+ Z
var vbInformation = 64; & A7 [# y2 v: u- [
var Finished=false; " b' D. C5 E/ k7 t
7 q- j. L& D4 a" L ~5 d* y, Hvar WSHShell = new ActiveXObject("WScript.Shell");
1 c! k& Y4 a/ B# F i4 Q% B% k% p* o, G
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; c9 }7 s' b4 ~/ [6 _- G
# D$ _0 i4 T2 ^6 L) y" P3 z- |3 Ysimple.SetLicenseType("Runtime");
, p* @' ?3 i5 b. |& u3 V8 r! o/ h - N* z/ Y4 K O; z' P4 J3 Z9 u
try $ ~ ?8 v: E2 d! [1 [5 v2 Q" [
{
/ p$ x- p" A- _ // Enter the path to a model file!
) V8 i% F; ?9 i simple.LoadModel("C:\\Models\\Test.spp");
3 A# m5 O: l0 `' w& K2 K1 S} ) K( g! o) W; `) r8 ?
catch (e) 2 M# T; x7 j" ?; q
{
. N8 X5 B8 e! M+ z+ c0 s WScript.Echo("Could not load Model!"); 5 R0 ]9 p$ l6 ~) Z+ z
WScript.Quit();
! f2 F; B/ p% i* r' S}
' [) c2 a: l5 D* |- G, m B, M8 M3 u' B1 i: `$ g
try
( n# c+ v/ g- Q{
$ l" t8 j$ A* O% _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - P0 q1 `0 G' @( q# R" n
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# Y5 f' S1 }6 X6 t if (r == vbCancel)
7 I! A* R" n" J# a3 |0 I# q { 4 B* f+ k q% W0 I( O- T' V
simple.CloseModel(); 9 G* \, s7 X! V3 M, m
WScript.Quit(); 9 i ]5 C. g8 F2 |/ j9 a
}
) p+ y! i+ I2 y8 |" O1 a a8 a. ~7 Z}
2 j1 m$ z( r1 K( h + U0 |/ l& h$ B4 n7 i0 C# `
simple.StartSimulation(".Models.Frame.EventController"); # U ~& ^: ?# o' d j8 B6 ~
- s3 i. `4 V- @; u, z2 H3 hif (simple.IsSimulationRunning()) 1 O. K: g% |1 }8 ^+ l
WScript.Echo("Simulation is running!"); 7 a% L y8 K7 i5 N4 e0 i
$ {' P7 ]5 G: x9 L( }// Wait until simulation is finished 0 f2 _$ g# _% J/ u
while (!Finished) WScript.Sleep(2000); 6 P8 d3 |& o8 G$ X
9 w) s1 u4 \) H0 g* Nsimple.CloseModel();
# G2 m. H% X$ Q" [8 Qsimple.Quit(); - Z# n, o" L Q& W. M0 H. V* c1 J
WScript.Quit(); ( B' ?8 j/ L+ q6 V" l2 x
4 ~( C7 C3 X; W+ f6 @
! _3 u; v# x- ]function RemoteControl_SimulationFinished() s$ P( t1 h3 C' n
{ / w! N$ p% Q- W# r5 L9 c' o. i
WScript.Echo("Simulation Finished!"); |