Example of a JScript
# l2 G- f* ?; c% qvar vbOKCancel = 1;
0 p& g Z1 E2 U6 z* m7 I0 Q: Mvar vbCancel = 2;
5 @ }* `$ P, H# S. jvar vbInformation = 64; $ b3 p& _4 g: `; f4 S
var Finished=false; % P. c1 Y; y3 O
% h2 J+ j) b+ B* ?" [
var WSHShell = new ActiveXObject("WScript.Shell");
k" B6 Z5 ]4 h2 e' B 8 T# f ~' G& P( E
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , b! K/ O6 c& i/ m
1 C3 E6 h% T% m: \2 \$ r7 @. @5 U
simple.SetLicenseType("Runtime"); $ t; m0 a7 b9 a8 P% R
' W+ L1 K1 C, I9 x0 G; y; L, x
try
( @4 d+ \8 [2 Q1 P{
( m0 B, h7 p: {+ P# X // Enter the path to a model file!
! }# N5 J' }. N simple.LoadModel("C:\\Models\\Test.spp");
3 B$ X& L; w" {6 D7 k% {} y) n9 }8 e0 }0 K
catch (e) , @ |: j% \! U- ~
{ . B9 z" K1 p8 x* ^7 F
WScript.Echo("Could not load Model!");
4 \2 }: I5 _4 p0 t Z+ X' T WScript.Quit();
! P- R* e. \' ~/ l! |2 S} ! R) x8 v* E0 o5 c/ N
1 ^( G# q. i. {. }" c
try ) m5 H+ m6 A1 r4 f0 g
{
1 r* m) i) o# M* c8 V3 e8 Q' h- W' [ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 f1 |1 l5 M+ S2 v1 @$ R r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 k5 t/ f/ |4 ], S( `
if (r == vbCancel) - A$ c1 Q) |1 R5 Y
{ 2 m$ o, u( y. c% `& w2 T
simple.CloseModel();
7 k; e9 v8 @% d: H1 w WScript.Quit();
7 `4 V1 P* n/ h } - l1 Z/ v7 x' M
}
# P( w' N7 N* \9 w# L 1 X5 z& s( D; t5 ~0 O1 W& v
simple.StartSimulation(".Models.Frame.EventController"); , @" \$ g! b% q( t! M$ m0 Q# U( R$ h
3 U% I& G7 E- V) _7 G4 q
if (simple.IsSimulationRunning())
7 p* c9 P8 P5 X; P" G: F WScript.Echo("Simulation is running!"); / l7 E! m3 T6 o
% U' E& ]# Z: h8 k" X; P7 |0 x// Wait until simulation is finished 2 y& x% w" [1 `4 G8 t
while (!Finished) WScript.Sleep(2000);
! M, N4 G* Q+ Y
. M4 ~$ S" b/ M; P+ Dsimple.CloseModel();
" J% ?! {! I# P. Esimple.Quit(); 4 o3 R( K" l# I: @- a5 v( w; I
WScript.Quit();
' k7 o/ t% X/ r6 `) C% w
- D- e1 t Y( \ 2 v1 ]5 S) S r8 l" s: r$ F
function RemoteControl_SimulationFinished() ) E8 W M& `" \) o( U
{
9 y8 o# d$ Y3 z! ~4 a$ M WScript.Echo("Simulation Finished!"); |