Example of a JScript
9 p* `& Y7 d- ]: @var vbOKCancel = 1;
, E# ?! W( x4 ]6 s4 x# m9 \0 avar vbCancel = 2; " i+ I i5 V) c0 i( o
var vbInformation = 64;
, |( X$ y, M! S. d6 Q* @' ?. c: svar Finished=false;
& B( f& }& Q3 A0 q$ Q
, R9 R$ U4 }* } Fvar WSHShell = new ActiveXObject("WScript.Shell");
+ A5 Y, ^0 d& x4 [) ^; O& y ( t/ |& P, s/ k8 L; u0 h+ R( V
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) P' r/ M! w3 ]8 l' b
( f9 O1 m0 G A5 [! @& G
simple.SetLicenseType("Runtime");
# r/ H, M1 G I& X
* o% {( T( l1 c- itry 8 x/ f% G0 Y) w4 g ~
{
9 U6 D5 ~& p4 A2 {, N( a1 O // Enter the path to a model file!
2 b4 ]/ K0 _+ E3 ~9 R8 U% }8 A# T simple.LoadModel("C:\\Models\\Test.spp"); 5 P3 W- ~- N& ~/ T# G
}
. ]/ X% I% @6 zcatch (e)
9 y: @; e( Z) g) C/ h. K{ : m' }6 X$ v- X' h8 j% r" \
WScript.Echo("Could not load Model!");
3 j$ j( P2 k2 I WScript.Quit(); - s. T# y5 s) w* ^
}
8 l) k4 `& [6 l% m: t / j8 h2 k" _9 v9 L2 C1 @
try ! C( Z, e! o1 q' T3 N) F
{ 4 w: ^, n9 O( d/ F1 R8 x ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 R. v$ F- Z- }+ ~( J' ^( X, E X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 w, _- } Z3 C2 j$ x
if (r == vbCancel) + h7 Z& ~* E3 }7 l3 B7 y" |
{ # v. D% Q7 J2 M. v( R
simple.CloseModel();
1 E4 A9 x# y& O: j/ e, A+ m" D WScript.Quit(); 1 h( `1 Z- b+ r$ d7 Y: L% G& J
}
8 h+ @# V2 |( k* L% `3 o}
0 Z% r i- w! q1 D" b' ^
! ?$ m- R, J2 }6 [, Lsimple.StartSimulation(".Models.Frame.EventController"); , _+ A5 I# D. U
1 v- p" {5 Q* b5 R. {& a& z2 O; jif (simple.IsSimulationRunning())
6 `% q S/ g3 g; ?8 m x) H WScript.Echo("Simulation is running!"); 8 }6 Z7 ]+ }1 ?
( J) [3 N: F3 D! H2 X1 F// Wait until simulation is finished
# z* G+ v) [$ Q3 Ewhile (!Finished) WScript.Sleep(2000);
6 Q/ p6 b+ ^ L" i; K
1 E- v1 @7 j6 t) \, j0 A# L5 z- Csimple.CloseModel(); 8 _% g$ R' B+ f9 x
simple.Quit();
: u% M; q1 ~5 Q* ^' `- A3 W& K6 T, OWScript.Quit();
' u0 ^, D- }) A' U7 H/ l
# e; W$ S& W# k, k5 p1 i
7 o; w: T, x h: e5 ^# V. Zfunction RemoteControl_SimulationFinished() " e) }. i4 S" X6 k# k/ p# C5 J. t2 c
{
- F( i3 N- |6 \4 b0 d# O WScript.Echo("Simulation Finished!"); |