Example of a JScript
4 d' y* m T( f1 e3 Ivar vbOKCancel = 1;
' f2 Y1 s/ O8 U0 b" w5 Jvar vbCancel = 2; , E+ ^. C/ E: a/ W) Y
var vbInformation = 64; 4 a4 V4 f1 C$ ~" t2 _# J
var Finished=false;
, k$ P" z1 n% P O8 A+ t4 [% m3 f' w3 q 9 J/ ^1 T3 K3 c' N: @7 ^
var WSHShell = new ActiveXObject("WScript.Shell");
7 n, ?$ l& }( U4 F$ F 4 M, g4 H1 ~- b( B& o# Z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 z3 g, C, T% H, g r1 n. ]2 A
* f+ a, _* Q; p4 E8 C) d/ m3 lsimple.SetLicenseType("Runtime"); ' d$ H/ L) J( b3 f
$ e0 A' n1 t& Y: e2 U, b+ |( f6 n
try
! i7 Z2 J5 J) N{
& b" V, R1 f9 V // Enter the path to a model file!
9 ~' F% v; }7 u V simple.LoadModel("C:\\Models\\Test.spp"); 7 k2 c6 E# E& l7 [, _ q) {
} # Y5 A9 C/ u. {: \) i2 H+ E0 @
catch (e) 7 F: ~( x+ b2 ]% g. y) @8 f; ]
{ 3 w+ o8 l; n4 |0 d
WScript.Echo("Could not load Model!");
( }/ u. u( i9 \% t$ J9 q3 O WScript.Quit();
* b8 T4 F+ ~& y& n# _} 9 U1 j: d0 V3 w# n9 O9 e! e2 `' i
% U: L% f/ F T; i# Jtry . d6 \' n& y9 W! d1 t$ g3 c
{
" T2 E0 @* y& C! U& K simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" h8 P3 w( ?9 T" u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / i( C4 x- O4 z/ w" h
if (r == vbCancel)
1 u# ^! h( {& L5 X; H# D { - a# W3 u. k( |" K9 L1 N8 a
simple.CloseModel(); 1 @. V7 b$ t3 C, c) R/ J
WScript.Quit();
' g; n! v- Q/ i. T# I$ l }
+ ?7 I4 D" B" f3 W: z" ~* W}
$ N8 X. \4 A, N' ?/ P w, e3 m, ]' v
simple.StartSimulation(".Models.Frame.EventController"); 4 ~' \0 P# |0 k7 ^0 B
/ z! L* n( S, Fif (simple.IsSimulationRunning()) ! x, t5 ~/ ^' L. y8 o' _
WScript.Echo("Simulation is running!");
: ?5 @4 B$ g, n/ a% B7 {0 K
8 Z3 u" H( Z! w2 Y// Wait until simulation is finished
+ s. N6 _4 }; y4 {4 {" T' E# ewhile (!Finished) WScript.Sleep(2000); ! u, o& r" q/ q' ]
+ _ R) k4 Z c9 ssimple.CloseModel(); 2 E% k, j! E7 s. r$ \
simple.Quit(); ) d! X) r. r, F5 {. g0 Z- X
WScript.Quit(); 6 n7 J& r _1 P
9 C7 ?$ K9 f0 T+ g ( O, Q u/ O p- o8 `+ A ^- E; O
function RemoteControl_SimulationFinished()
, Q* |4 N; t# ^5 V{
6 k/ b9 [/ e* ~. B3 {; e( m WScript.Echo("Simulation Finished!"); |