Example of a JScript : @9 l1 L$ a6 Z l+ P% x
var vbOKCancel = 1;
# ^2 I/ A$ S9 m$ hvar vbCancel = 2; , O* g- o2 l D; G9 S4 n
var vbInformation = 64;
. S9 P& d, a5 X8 O( ^7 Dvar Finished=false; ( t; ~0 _+ Y% z" m% b
* M/ y* X) ~$ L3 `0 k+ j* v( [
var WSHShell = new ActiveXObject("WScript.Shell"); ) `3 n( F; |! l+ M' m) ?
1 M- j, C. d( r, [# H, Hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' L5 z! y) |! ]$ ^) A+ f. d) O0 g: H
# A( Q- c1 _4 U# H4 u4 Z6 ~2 asimple.SetLicenseType("Runtime"); . `) c0 O4 c, Y' a
8 @+ D& H! Y# ftry ! W; Z: A7 W% e# v7 {( s# [
{
1 S2 T( j& X( j' `" b4 Z$ \ // Enter the path to a model file!
5 h9 i! V( l( t6 J8 k4 d, I; d simple.LoadModel("C:\\Models\\Test.spp");
$ ?! w+ V9 Z1 X}
$ B+ i6 G0 f7 G# a; Fcatch (e) % W4 t# G0 ]& M; ^7 u+ g4 g+ K
{ 1 m( o! S3 r0 {: T `+ Q* g
WScript.Echo("Could not load Model!"); . R* p( o1 J! s! \% [" [# w
WScript.Quit();
5 h& ~5 l; i+ w9 ^! q$ t}
* m7 y; l) l- W ) z" R! m: m" X9 T3 ^2 O; m
try ! ^; F0 j% k0 T& |( p: y
{
: I( Z6 C- Q) n' M' j! N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 [3 q* b- U+ q6 e$ J9 d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ P9 T; H: m8 w- k, n: U if (r == vbCancel)
' L/ ^# b0 U: S# O" r {
~5 K& ~* U/ L$ @! O& x simple.CloseModel(); ; U: `" u! K1 C' T9 ?
WScript.Quit();
4 B! {7 _3 R' Q O7 ^ } $ m" T' o2 S# w; G
}
* r; t/ z1 h2 R: \0 m 3 j& J: m K: K5 {! k1 }) L- R
simple.StartSimulation(".Models.Frame.EventController"); & i0 ]; q0 ~3 r; C; p
& g( ^9 n' d) |2 I1 D {if (simple.IsSimulationRunning())
' a% k) U- l1 A WScript.Echo("Simulation is running!"); * O4 ^* ^( m2 `4 E2 J6 {( I
1 R+ O- o/ i: {. Q0 X. h8 k9 [
// Wait until simulation is finished
' n2 V) I$ d# d, w2 n: Swhile (!Finished) WScript.Sleep(2000);
) A' x6 Q* x1 _3 i9 q 5 @ V: O( x i1 f& m% [: S
simple.CloseModel(); / H! a; X+ U5 u
simple.Quit(); : F* _) F9 p; t% x# Z3 e6 d
WScript.Quit(); % t6 m2 X: \* ?& u4 L2 f
+ V1 }; n( f& G5 l, V" ~3 ?" G
! m; V# d5 e9 F* O9 L/ M m8 b1 O
function RemoteControl_SimulationFinished()
4 f( g+ `* H" K H{
, l0 C" g' T: O6 ]# A/ Z8 ? WScript.Echo("Simulation Finished!"); |