Example of a JScript
! Y' v; ~: I. w% m& `1 e2 F8 z) Ovar vbOKCancel = 1; - ^* ] F; ~6 `( l, }0 Q# T
var vbCancel = 2;
& S7 E. Y0 B" Cvar vbInformation = 64; 3 m4 ^; n. H$ ?! E4 ]9 _
var Finished=false; * y( H9 T$ D+ Z% V9 h* l
2 e. u6 L# m& U: ^+ Y- Z' ^
var WSHShell = new ActiveXObject("WScript.Shell"); 9 Y+ O/ m& A9 ]/ C
! n) }% |4 N' @+ y1 R( l* e& t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & V2 q+ i9 q+ w0 [6 }4 J
+ J* Q- R0 C* K9 b9 ]; z8 qsimple.SetLicenseType("Runtime"); , [0 l# x3 R( q4 O! M; c! w
: I" G1 A& e* I" v
try
4 z/ Y& w7 U2 \9 @4 C* D% S' d9 j: L{
; J2 }& w% `7 g // Enter the path to a model file!
* L9 k. t6 ~' T. B: f9 ^ simple.LoadModel("C:\\Models\\Test.spp");
9 J5 T8 R7 m7 v- O0 ]7 n}
3 f& {7 `" e. `$ q3 `( f. _catch (e) " _* I* C6 J9 a5 [
{ - V5 F0 q# y0 q k. l& F
WScript.Echo("Could not load Model!"); 9 p" W# i G/ y# Z# {! q
WScript.Quit(); 1 s* {5 W9 l9 l
} 4 \% L" n8 X S4 _0 g* R
. o) O2 O8 ^/ M+ X( D, X" htry ; b3 L% J8 i) ]; N9 ~7 L" `4 ]
{
: B) E. z$ @5 X. {# d5 x9 w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) F$ g& t6 O9 h2 ^+ Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) @2 ?5 F1 l+ |5 ^ if (r == vbCancel) 4 N. @8 N- F; C z8 g; T
{
, r3 J- ]9 P! A2 v) h! P$ f6 q simple.CloseModel(); / y4 t) r* w' B, X+ r' A% x
WScript.Quit(); 8 P8 q* `- B$ b& j( f
} % T A! k' X2 j0 F; h
}
& T x: u+ S7 q- L# ` 6 V Z! @" N# N9 y
simple.StartSimulation(".Models.Frame.EventController");
- x3 A% T \5 K' e, E1 y/ [
5 ?) x" C) Q: e9 Y% Pif (simple.IsSimulationRunning())
& w. [1 \9 D6 N( H; I WScript.Echo("Simulation is running!");
6 s3 o6 A& |3 f- q# E
: n4 d. e' r; S( e* m# O+ b6 |// Wait until simulation is finished 9 w _% s3 W/ _9 G2 W: O, @) o4 S! Y: M
while (!Finished) WScript.Sleep(2000); 4 e7 F0 i3 p) a V
! j! b; o. _7 x S9 dsimple.CloseModel();
0 ^" T" U7 D0 u4 `simple.Quit(); 5 C k; T8 Y* S7 y6 T# D6 h
WScript.Quit();
: x2 u: Y! v4 C( W2 q, L
6 E( t$ [/ V+ j; U2 ^ : c/ @) N$ _7 c% G2 Y
function RemoteControl_SimulationFinished()
! d2 I% y0 ]; g: l4 p/ E& F+ V{
* D% B9 L3 {# K# m) ] WScript.Echo("Simulation Finished!"); |