Example of a JScript
+ y& c0 z; I# {5 h+ e/ H4 C. ~var vbOKCancel = 1;
1 T2 N4 N" y/ Q7 x0 ?; Z: Z9 pvar vbCancel = 2; % w# y; `) p% K! Q; Z' W: \: D9 C
var vbInformation = 64; ' H; N6 i: E4 H( V
var Finished=false;
# V1 Z+ s) x/ Z5 v, d# `4 w
+ P; y% m# j; b+ }1 e* tvar WSHShell = new ActiveXObject("WScript.Shell");
, I+ |' b3 \# T" h
4 M1 j; y4 a9 {5 b' i" [9 M2 avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; q/ y7 G0 M, J
8 K$ _+ K& W$ p* v! E: ]' L
simple.SetLicenseType("Runtime");
0 m; u. {! N: U! |$ P } 8 {; C$ g/ u7 u& D3 A+ s
try 5 d/ w: _+ t" m, F- X+ M
{ 5 n3 s) S! [1 F3 L/ f$ N
// Enter the path to a model file!
6 g) Z9 S1 u/ E; [" p/ l) a/ g5 I1 | simple.LoadModel("C:\\Models\\Test.spp"); " n5 o. {) k0 u* o6 e' `0 _ c
} " E5 z& u" ^" E F0 V
catch (e) 4 c* T8 d' T9 a+ E& `' O
{
. {$ B5 j5 Q2 g! u WScript.Echo("Could not load Model!");
# [- {/ I; U5 a WScript.Quit();
0 J& I* d$ m% T! F+ l; m2 c} ( M7 Q0 I( O# I7 K! [
% ^+ b+ D+ \ ?7 Z9 _) S
try # P" a) q1 q$ B. g( E# W) K! `
{
: n- L$ h) {( d' _7 L simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* Z9 F& a9 V2 r& k/ N- I" M1 y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 G" [& n. U# d; V if (r == vbCancel) ) v8 [6 K$ `6 c# t. E
{ 5 o6 ^7 g5 d' q4 H- G( y% Y
simple.CloseModel();
* w }$ V, N+ s; J WScript.Quit();
. Y3 [# C* Z- h6 l& P+ l, l } Q' c2 G! L" H/ {$ R
}
J! T2 q- `0 K0 h& g" W. v / @9 b! f! [* |6 q3 g
simple.StartSimulation(".Models.Frame.EventController"); 8 F* \, b' G0 U7 N: [8 ^" x
" o( s2 \( c8 N- `5 Tif (simple.IsSimulationRunning())
5 A1 e6 r3 M6 L& ]2 z WScript.Echo("Simulation is running!");
+ w7 h$ I- n0 m- D+ i! ?- y . ]. n2 B5 l4 j7 \
// Wait until simulation is finished
" L5 W. N0 y7 j" Gwhile (!Finished) WScript.Sleep(2000);
0 r. S9 d1 q; W! q
" |$ u- F) X3 [( o) H7 Rsimple.CloseModel(); 9 u# ?& W# }! \* j& c# P
simple.Quit();
u# `: ^7 M# G. N9 V" [4 U1 M; {WScript.Quit();
^; W8 }+ x6 ~2 x& P/ k 9 U. I: @2 J' i3 t
% K3 M% O- ?, V' N/ m2 D. ?
function RemoteControl_SimulationFinished()
) F6 i9 Z' v# C% M{ 9 \1 M% I# Z& m# N3 E
WScript.Echo("Simulation Finished!"); |