Example of a JScript
/ z# K. }! x# `. J) E- {# K3 M- fvar vbOKCancel = 1;
# S" I* n! H/ u9 h) `; [1 yvar vbCancel = 2;
8 n& _0 ]: ~, v7 wvar vbInformation = 64; / {$ }% E/ R/ Z- K- p7 ~2 v# Q# R; q
var Finished=false; 0 q& t0 x1 C- r! U3 H% [
+ [- `9 }/ ~0 X: T. G n1 P% H
var WSHShell = new ActiveXObject("WScript.Shell");
' z! B7 A) y/ r z9 h% \) A F5 S) b / Y1 f! e. C7 d; [& c" R5 ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * S4 s& D' o/ \4 z U# _9 L
2 m- Q8 k3 o, Z% N( osimple.SetLicenseType("Runtime");
3 h% t" b( S1 {) s) ]+ i- s& {# ~
& N U& J( O0 I' xtry z: q( f( A9 ?1 Y# Y2 g, G3 ^, [
{ # Q! y) K- Y( z: S7 y! Z( @
// Enter the path to a model file! $ Q3 ~& S6 k4 U8 y
simple.LoadModel("C:\\Models\\Test.spp");
2 H; C/ z/ g' U6 x A/ G+ [}
8 p+ @9 }8 W+ j% ecatch (e)
. |9 @% W( g3 d2 r) z{
0 ]3 [ n3 {. V WScript.Echo("Could not load Model!");
( w" A" H% T. y, {/ W WScript.Quit();
% Y0 U$ K q$ l7 \0 |. u$ H}
# ] Q& y8 U8 O* @1 a* L4 a; g
5 {0 q8 \7 ~( T& dtry 9 B- H9 C/ Q7 S, Z8 Y6 m" G& @
{ 5 O3 j: Q }& j. |. O1 q& k
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 ^; k6 t* o$ {4 R( P/ i
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" X, e. U" }* ]/ z' @ if (r == vbCancel) ' J0 ?1 m7 D, D: R
{ 2 R. Y6 ^$ h, }2 C& S# H1 S
simple.CloseModel();
4 x1 ]* M1 e7 t WScript.Quit(); ) K; N. x& A$ F+ j
}
6 v# s8 G0 D# u+ j3 r+ X$ [}
4 I$ i1 r) T; Z6 U: [4 C8 i
$ i" y4 o2 m+ R& _simple.StartSimulation(".Models.Frame.EventController");
6 O" L' V' A( l! D' b! A ! p/ L3 |; x- E
if (simple.IsSimulationRunning())
' A% E8 ~7 M9 r( I/ F4 F WScript.Echo("Simulation is running!"); $ {( N/ ]5 Z: F% P( o( W# w
! t! Z# F7 o1 E. [! w
// Wait until simulation is finished 6 a, T' D2 I9 u) b3 q3 o
while (!Finished) WScript.Sleep(2000); * _0 J0 V0 T& W) e) e( M
) W9 u8 @0 p& _- P- a# }simple.CloseModel(); ( Q( z: p- h" F; l9 @
simple.Quit(); & s! {. V+ i) i, _
WScript.Quit();
) Y' @& F7 J9 ~: l; b: S, c
' b# C. U' B" I' b3 ^* E, ~3 x0 O ' Q# C: R5 k& I; H9 G
function RemoteControl_SimulationFinished() 6 l4 b5 K& B! S/ O
{ 2 M8 X/ N) |; C Z% r
WScript.Echo("Simulation Finished!"); |