Example of a JScript
8 s# C" A6 \$ c( m1 Q/ e: j2 avar vbOKCancel = 1; ) U" e# N: @- ~; K: ]1 E
var vbCancel = 2;
* g8 `: h1 z$ l) r; u& o: @0 hvar vbInformation = 64;
; H% A, q- P }' a3 y7 W! }, Kvar Finished=false; 6 o, A9 n; h5 U9 v( J3 o
9 F \$ u3 e) F" {$ Svar WSHShell = new ActiveXObject("WScript.Shell");
# w' }; p8 b7 c& h7 S* B' y ! C8 V# p- b9 X" W r6 `- w: D) F/ b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: d# X9 ?2 N# a* N( z0 l1 A( t7 s" g " K1 s! r& q6 C+ `
simple.SetLicenseType("Runtime"); 0 ?; P$ @7 j+ i5 ^0 @! z
' O; ?; q/ a# Z0 U" Q) C6 M
try
6 G+ n' q3 L' D! _{ : c3 D$ K. ?: q% E6 H
// Enter the path to a model file! 7 ]/ }" `+ C1 {
simple.LoadModel("C:\\Models\\Test.spp");
. b" w7 u7 O2 b6 x3 d# T* p} . ?' ^+ \) G$ T. m
catch (e) + e- u+ ]' X& j5 L2 C7 ]
{ 8 h$ u7 ]6 i, @/ @$ \# ]
WScript.Echo("Could not load Model!"); # X$ ?/ [9 T5 B8 I4 P7 u0 u
WScript.Quit();
4 U7 g" l! X$ c5 {+ H: K} , E u4 ] Y4 X' D: u# `" `
# F* x( V4 A4 V$ d3 l& mtry
; E6 u9 u; V, F6 w) b5 J9 n$ u0 I{
8 O5 O2 X) ?( x7 s# h simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( x3 k9 R' ]' N5 O
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 e' S6 C( V7 D
if (r == vbCancel)
; j. T" A) {& @( w' P$ J+ _$ h { . k& p% F3 g3 q
simple.CloseModel();
( C. r3 j! `2 B/ Z$ Q$ F$ J WScript.Quit();
3 r/ W# q4 \# i& p/ C/ @3 o } 9 N& q3 q2 Y0 q5 Y4 V7 {8 O
}
1 y; m9 B: i5 [: @ " Z6 }; Q$ Q# v& I+ ]
simple.StartSimulation(".Models.Frame.EventController"); J/ L& _! N* K$ U! H
0 q( v; K h! H7 s& ~
if (simple.IsSimulationRunning()) ) G' I( D9 q R7 R
WScript.Echo("Simulation is running!"); " m+ ]- p, n' q6 I6 ]! |2 i5 N
4 P! ?" l! E' F: w* t7 Q* V% ?
// Wait until simulation is finished $ T" w* S: a+ ~
while (!Finished) WScript.Sleep(2000);
0 q2 Y: e, |" l" ~ " j8 x+ ?/ P! |2 q
simple.CloseModel();
5 G3 \5 b! o2 d. d) e- u* A' Nsimple.Quit(); . ^& v0 j8 X! l7 m
WScript.Quit();
5 ~( E7 Z! p% o+ H( Z& i 7 h+ q( B3 _% P
( A! o4 b- k- u: v z6 v
function RemoteControl_SimulationFinished()
8 }8 |* X; x, G9 |$ U# y{
, G( E6 _. x+ J4 l WScript.Echo("Simulation Finished!"); |