Example of a JScript . W2 C9 @4 R k6 S
var vbOKCancel = 1; 1 J/ _8 B2 O9 f1 p. n
var vbCancel = 2;
) m/ D g. E2 P& t0 N2 yvar vbInformation = 64; + y! e3 i$ t5 K6 r
var Finished=false; / _9 a( F; O5 B# d4 n# P A
/ C. n! V% r' b/ q; w" \
var WSHShell = new ActiveXObject("WScript.Shell"); & |3 G* o" g6 H* N/ V
, g+ S3 S' H% N" d9 `/ b$ Z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% k, M1 i: o; `/ \9 E$ c : B, X# W' F* e# n0 w* e1 a
simple.SetLicenseType("Runtime");
% S. O$ f y0 T$ V/ C5 E
D$ C8 z6 b1 w2 n0 ]try
+ X4 m/ ]" \: O5 M! X& d0 {{
8 x' a9 a* M+ ]2 i // Enter the path to a model file! + f) ^9 r# C" X* x" _/ V6 J
simple.LoadModel("C:\\Models\\Test.spp");
4 {. `5 F3 t7 ~' z. z' {} - H" ^( c# n5 n% t4 @
catch (e) % x" f* k" s0 t! w& p! ~9 ^
{
7 |$ [1 |' d4 C WScript.Echo("Could not load Model!");
% G" {( Y1 s, Z+ Y3 c( T WScript.Quit(); 1 u" C G% w9 i+ o8 p9 o) K% D
}
; C6 k- |5 r7 E; d4 ?
9 ]- ]! \: F( F6 }* A+ ~try 0 e: m+ F) @# N/ W+ Z8 Y
{
9 X6 F9 c; x$ v& s; Y- k( c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 }& J9 k( K* S1 V( g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % ^+ i2 P: h( ]$ q- {$ H
if (r == vbCancel)
5 h o: y w1 R8 y5 b; m {
% ?1 `. y- ]6 N( \; j# A- [ simple.CloseModel();
& e4 Q0 ?$ U/ j# i, U. X2 } WScript.Quit();
8 T; |- U( D, p( O* G } / E8 ^2 v7 l- ?- L2 f6 Z& Q
} * r% f5 \2 E- y( p3 {5 Q
/ j, i' `3 K3 Q$ |
simple.StartSimulation(".Models.Frame.EventController"); * o6 i# ?- S2 g7 i
. w, X3 `8 g# O6 B- r
if (simple.IsSimulationRunning()) 9 i1 N/ X( y! |
WScript.Echo("Simulation is running!");
& y. B' [+ a" D; D4 I# p' C $ R; ]$ \7 z! z; G$ H
// Wait until simulation is finished # \; `" G7 @2 N; i/ I+ k8 g1 R
while (!Finished) WScript.Sleep(2000); 3 l/ P; ?7 h9 E% U
5 [8 X) v1 _7 h
simple.CloseModel();
7 r" G4 w, y+ X4 H4 `simple.Quit();
; C+ C5 l4 D6 z! M+ t4 S8 l RWScript.Quit(); : {& l& h W0 i3 t
X; @' H' E! c4 ]4 k1 G( Y , E2 G: |. a' e1 N7 s9 O/ u
function RemoteControl_SimulationFinished() ) U( G8 q }; ~2 b
{ 9 |8 u2 k7 T, G! P3 \' }. ]
WScript.Echo("Simulation Finished!"); |