Example of a JScript
" r' V& X7 K3 O" f3 Nvar vbOKCancel = 1;
" l- i0 A8 p# hvar vbCancel = 2; D' t0 U5 v2 c: B& b' ?
var vbInformation = 64;
6 E; [1 {; ]' w/ e! Avar Finished=false;
1 K2 K: M g# r 1 A2 P; D( s5 X- x' S( O
var WSHShell = new ActiveXObject("WScript.Shell"); ! f$ p9 z3 L$ M: Q1 f, ^
I( f0 y L9 R4 |# k# Q( @; s5 f& P' d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - r) }+ W/ v) R: Q4 d
9 O0 A$ b+ I0 K, f8 S8 {4 x; ^' Psimple.SetLicenseType("Runtime");
$ {, k% n8 u% K9 f5 B: p* [0 a- H ; p8 x. T2 v+ U7 _7 r1 X8 {
try - s4 x7 l& w: m
{
2 [: r- N" S& ~ B // Enter the path to a model file! y. X- N0 h. T* _' y$ l, O
simple.LoadModel("C:\\Models\\Test.spp"); ) c7 J& Y2 E4 I8 ^8 L5 `; O8 w
}
( v4 ^+ ~" w( d T( Z- ^catch (e) * x( a/ S; J b+ E8 h
{ 9 ~1 h: r! ]7 Q- t7 c/ K
WScript.Echo("Could not load Model!");
6 ~' d) S5 u2 m2 [2 x8 T( ^, F WScript.Quit();
2 N. y ]4 h& A}
2 O' s+ ]/ r1 J% ` : F5 {) z# @3 Y7 ^$ _
try 7 Z# d+ `2 c% Q5 w& W4 j
{
6 h) \" m$ L; n" J) c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# u/ Q* `$ x9 Y* r% o/ O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( c, f) f3 v/ ]( o$ \/ ^
if (r == vbCancel) ! ]" B; C2 l4 V) K- t
{ * x! Y2 g/ R2 k- R; j8 s; N# I2 r
simple.CloseModel(); + t6 t6 n z. u6 u+ V: `
WScript.Quit();
5 o8 B8 l; n2 \ }
4 D- V: [; l" q$ H6 P. {. O0 Q}
/ q% H6 \; ^; Y6 h 4 c' A! {$ T6 X6 {+ H( }) |$ [4 m
simple.StartSimulation(".Models.Frame.EventController");
D2 f$ |* S$ `- I ?: P
, I, e( N8 b) w) _if (simple.IsSimulationRunning()) . w+ H- x. l( L3 T
WScript.Echo("Simulation is running!");
) F/ U: C3 I- }) C+ z2 c- l+ @
) v0 j! l3 z) U5 V% u# T// Wait until simulation is finished . E. b8 Z" x" p( g+ h1 ?
while (!Finished) WScript.Sleep(2000); . q$ e) F$ w) N1 \
1 y7 D+ M! J# g& D' t, T: _ v
simple.CloseModel(); 4 k2 p$ k" X* i+ K$ ]8 ^
simple.Quit(); : i1 i1 ?4 @3 B, ^2 ?
WScript.Quit(); + Y8 Y9 E/ a& O- R
, U4 C/ j1 n0 p; J: M, i - m% U! } L6 \( ~$ \2 j
function RemoteControl_SimulationFinished() " C3 }7 O3 f: Z7 K9 \3 G
{ , x) f$ \& ^8 M( C1 K
WScript.Echo("Simulation Finished!"); |