Example of a JScript
' D7 @/ j2 a; M3 {2 n; P) Hvar vbOKCancel = 1;
2 [3 n4 D/ H' e) ]: i1 jvar vbCancel = 2;
5 R, t3 ]3 C3 o$ bvar vbInformation = 64; $ g( D& Q! r$ L G9 b
var Finished=false;
, e3 e( L9 b/ J% j. H
5 u! X; R/ i I& T8 ~( Pvar WSHShell = new ActiveXObject("WScript.Shell");
, Q8 @ l. @! @& H! m& C( c
# d* f7 Y, H! O: z+ c/ Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ Q& z+ D |8 }1 [2 F+ c 1 u2 Z2 e1 ?2 ~+ k. W
simple.SetLicenseType("Runtime");
$ c( j+ |8 \8 K1 D; T! K' h# v4 F% x % K+ a8 X9 U" N5 q. ^
try : ~5 m+ u6 d4 N' p( Q
{ 2 n3 m2 U b- h8 @" P( y
// Enter the path to a model file! ; V6 x7 f6 D' m" g
simple.LoadModel("C:\\Models\\Test.spp"); & Z" Z- y( j" H' |' I" `5 t
}
8 R: v9 P) Y/ @2 A" Wcatch (e)
$ k0 ?: @$ |: ^% c0 n{
+ D) F8 t9 M/ r* E1 ] WScript.Echo("Could not load Model!");
2 S6 l d4 w) U; u# F WScript.Quit();
9 w/ I( q5 U: v4 S5 o4 E}
& P" Z( \. v" s1 M
9 X/ F6 w& l$ s& |' Gtry . A8 J+ u4 l. T
{
8 ` A) C& Z; U8 F8 Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , d. ]! q( w4 |! `! c6 i
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" C+ O h4 ?0 F7 k: ]% e3 J, K if (r == vbCancel)
0 i1 Q, ~. w0 w) v9 i {
0 k- S6 u' T5 F* o5 Z" O5 K simple.CloseModel();
2 O; @$ _2 @# D, s) w T# u WScript.Quit(); ( |$ M4 L* v5 d) p! o1 @2 Q; u
} ; F/ Q& {; q: M+ ~- k
}
7 ]$ ]& `, k) r: j* o& m5 e. t& t 4 [' T9 E5 `: z9 Y3 D
simple.StartSimulation(".Models.Frame.EventController"); 0 P) o+ m( N+ _: b0 N8 l/ Y' h8 d
+ q. N9 [ z0 f& j- b! Iif (simple.IsSimulationRunning()) 2 W# w; ^( j# P% U+ O; |6 a! N1 i% e: b
WScript.Echo("Simulation is running!"); 8 T& f1 H/ e0 ]8 [$ L
& M6 A5 z- j }; P" n// Wait until simulation is finished
. h4 u- P4 g: O% Owhile (!Finished) WScript.Sleep(2000);
$ X4 A) {* p+ Q! I' g
6 a: j0 `6 B/ ~5 V2 csimple.CloseModel();
( i& b3 S# j0 P! V8 Ssimple.Quit();
. {' ?% `2 H( {WScript.Quit(); 5 \3 C( X: T1 T/ l0 C( e
g$ y1 D( o: a, A
" A N1 e3 b+ f" }- F Ffunction RemoteControl_SimulationFinished()
H% O% c1 b7 i{
- {2 S/ r7 Z" B& D WScript.Echo("Simulation Finished!"); |