Example of a JScript 7 W/ J5 b8 T1 h% k w/ h. O# M( Q7 @
var vbOKCancel = 1;
5 ]+ T! x5 c o: Z$ p( q1 ]' jvar vbCancel = 2; 1 J, Q9 ^" D$ s r2 m: F+ x
var vbInformation = 64; 4 ?# _7 R' h2 \6 ~& R" _
var Finished=false;
' f( Y5 j+ l4 P/ \; } / q, s/ o9 r- d# |0 _
var WSHShell = new ActiveXObject("WScript.Shell"); 3 N% z3 d( ^$ P3 s& c
* P7 v1 e/ s* B' D/ l) }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( {8 p1 L. |+ |2 \: s" Z U0 K # R$ ~% N* T4 n7 E( c" k
simple.SetLicenseType("Runtime");
1 k o4 h, \9 r- O' g e, V0 U 8 c- }9 Z# h$ o" G o8 W
try $ h( y: d" N( |# C. O: d7 W
{
$ h: D2 l) L* [ v: k // Enter the path to a model file! 0 y; m' ^7 B9 Q! q' x7 ?5 ?( ]
simple.LoadModel("C:\\Models\\Test.spp");
( D1 p* k" w" D+ C2 J9 t} ; r) g% F$ z; K# T' R
catch (e)
' r5 ~* D7 G4 O5 L% b' ~{ 3 J$ `- o. l2 \( S! W; J
WScript.Echo("Could not load Model!"); , i7 Y8 U* X/ `! P& M- Y! `! v6 j
WScript.Quit(); # n$ U( l6 [7 s! i, r
} + z0 P6 {4 ~3 O2 H- D) [
2 R; M. B; A, _; g
try * H) ?( u+ L, B7 H0 L, a. x' K
{
1 U; O4 }, V0 b* f s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 ~% X7 i9 W: z$ R( M
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & `" T7 R$ l# r$ ~/ }
if (r == vbCancel) 5 J) q+ X( v6 B& X7 j5 Y
{ 0 |9 E/ N J( r @+ m- \
simple.CloseModel();
- `4 ?" |4 B! c3 N' b2 S5 f WScript.Quit();
4 N# _1 J" d5 I0 h } 8 I6 Y6 V# t2 z8 ^: g% t/ v$ x
}
$ ]2 \* j: W2 H# v
9 r, |. G2 `( a- _6 Qsimple.StartSimulation(".Models.Frame.EventController");
( L, a9 c( ]0 J' j; ]6 o ; H7 n3 E6 B; R# ~5 v
if (simple.IsSimulationRunning())
) [4 M9 N0 g! R7 @( t3 S WScript.Echo("Simulation is running!");
1 a. i; p" P% W9 B a6 |. W 0 H b1 N9 {0 x* j- q$ U
// Wait until simulation is finished
% {* l9 [$ C5 g! T4 {( b9 [7 y+ owhile (!Finished) WScript.Sleep(2000);
; R/ c$ s8 {. t2 M- L . k& G8 T' ~# x+ G
simple.CloseModel();
1 I* O2 ^1 M7 h. w) T$ R+ wsimple.Quit();
5 f6 e' g9 e* f& {. |WScript.Quit();
# F4 ^% G6 p) s
3 E1 G; \5 }. @: S/ O6 F2 k
W) h4 N" } r4 q; ?7 Cfunction RemoteControl_SimulationFinished() 1 j! Z0 ]$ }, ]- j, \* m0 H4 j
{ + y' _% Q" s9 q
WScript.Echo("Simulation Finished!"); |