Example of a JScript
9 r* A2 P8 _* K3 f) ]var vbOKCancel = 1; 7 Q# F9 ?+ E1 s2 {
var vbCancel = 2;
- G2 F4 X# `4 A+ U6 k* `4 xvar vbInformation = 64; 2 Z. o5 S: K# u X
var Finished=false;
/ V2 Z* Z5 j2 C( q ( O& v6 ]- z" s) x, w/ M8 k- ~9 F# m
var WSHShell = new ActiveXObject("WScript.Shell");
) ?! c1 S$ e7 z
) W3 R' [$ P9 Avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % Z( x( r) b$ j
; p( p/ x1 a4 U; Q. z" f% [4 [
simple.SetLicenseType("Runtime"); ' l/ S6 m, I% p) H9 w
% s8 n4 s. D" ^# f( `
try
4 S0 v/ T1 r4 D6 O) @' b/ F4 ^; }% Y0 s{
' ^9 T/ m1 L4 e // Enter the path to a model file!
5 ]" ^, y2 n9 \' U$ X6 L- M6 o simple.LoadModel("C:\\Models\\Test.spp"); 0 x: d* I3 p% S8 a
}
2 K" @1 X9 x4 e q; }3 j4 Acatch (e) 9 [: Y" E6 _9 F5 P$ ^
{
& d! ]# _8 @, c+ R1 f+ [2 f WScript.Echo("Could not load Model!"); # K1 s( e; @) A% i; Y( m( G* f( z
WScript.Quit(); # a+ N4 g" l, L" ~! V- j/ |
}
4 L5 K9 f- D% N0 D- t' i1 H 2 w/ q" B5 e; I1 D, K
try
: K5 B- a* b6 t7 \/ i! [ Y: E# D{ % {# D& \% |5 {' ]; G* J! D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 F% q0 u) Z- }# q% J- }" _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); h1 p% s! c9 p1 e' c8 f
if (r == vbCancel)
9 J5 c/ O! ~: i8 W! d" \ {
- E {1 b. O* j5 i6 Z simple.CloseModel(); 2 N- u _# c3 [# ?% G5 N
WScript.Quit(); / D( X# O5 i$ m- |( |
} 8 w6 w6 I- L* D, m7 \: a
} + J; X7 X9 U9 H7 D
, b, H4 e& l$ v
simple.StartSimulation(".Models.Frame.EventController");
) [8 ]0 [' k1 n w# I5 i. d% Y; N6 ]8 }
% N8 J1 W* G0 Y9 W5 V* Qif (simple.IsSimulationRunning()) 1 C" L( ^+ R- T6 w
WScript.Echo("Simulation is running!"); 2 y }) D) i$ J0 @* U6 [* Y1 d$ @4 E* Z7 F
- v3 k* Z* e1 w. D
// Wait until simulation is finished ' C# Z; F* H' C
while (!Finished) WScript.Sleep(2000);
# z& _) m: H/ X% G6 [
2 L7 d+ Y- y, m- X8 d0 M& H% psimple.CloseModel(); 8 t& n, k F9 P& e. ~
simple.Quit();
; F7 F6 l$ d( [8 t! N4 T" `7 ?, }WScript.Quit();
# c# b* X% J8 r, g8 u9 [; c1 o 7 ]8 i* w" F! v: i
% ]# z$ w z8 {; |
function RemoteControl_SimulationFinished()
: O) }0 }9 T0 }: j+ y `0 p1 B( ]8 q{
- z: ~, q8 b: f* |3 V WScript.Echo("Simulation Finished!"); |