Example of a JScript
9 e y! ]# r$ U6 nvar vbOKCancel = 1; $ C# A9 j( P$ P8 f E1 h6 `+ O
var vbCancel = 2;
! {! f: e* U) t5 E3 Avar vbInformation = 64;
2 ?0 T7 K, ^9 j! f3 z6 `9 ^9 @# fvar Finished=false; - o# W3 h" g# X" ], T. x
" r; v, }: [8 c, g
var WSHShell = new ActiveXObject("WScript.Shell");
# t* r+ p2 ]- C! Y $ p# k. w- z3 @" A2 ~8 r6 k
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 C: X% m) e( } p0 u4 j
u2 U+ p2 E. M4 tsimple.SetLicenseType("Runtime"); * K9 q8 M/ f8 q/ q$ Y1 M3 g; b
/ D! \: x8 r Q n' y' e
try ) ]9 E3 Y7 o7 M* q
{
* k9 t3 ^7 B/ u" ]5 F5 S; s/ t // Enter the path to a model file! & y) Z4 Z+ [2 D, t& R7 v$ ^+ _3 K
simple.LoadModel("C:\\Models\\Test.spp");
" T; U/ G- J# i) \2 F+ m} ! c/ j- `1 V4 z8 O
catch (e) 4 i) b# z4 J' G0 r7 n7 n
{
+ P2 o, k; X; U* r" f WScript.Echo("Could not load Model!"); 1 y8 @& o6 J+ [: \) m
WScript.Quit();
' _' C% e8 |& W* d. @6 p} 5 K0 Z a' R* G. Y7 X2 [5 B
. \3 [0 a: [) ?
try
6 Z( Q, U) W; H1 E; M. g{
2 ~* ~$ [: ^, d3 w! j6 i simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
}1 y- f: @ y# W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ k) P2 q3 X2 p& E3 L- m# U if (r == vbCancel)
9 b, [; S/ r, q' j' T" _9 W {
, h( J, h2 Q$ n simple.CloseModel();
W7 i) o8 V$ P9 i/ A$ g; d WScript.Quit(); . D# ]" s* F. Z$ b5 B( g
} ( |$ t8 [9 u0 h
} / }: P k7 E+ p; J1 K
( g- x! C) P, w
simple.StartSimulation(".Models.Frame.EventController"); , l/ m8 D9 U& U! `, k- T( w1 Q
1 ~- a7 A& Y% \0 `if (simple.IsSimulationRunning())
+ N/ m4 w @7 z, A: f4 [ WScript.Echo("Simulation is running!");
; K9 P. j& I8 f: X" Y: ] * X4 y% ?, U( M; K- B4 q7 ?/ z
// Wait until simulation is finished
' B( F+ s S, J5 L6 }8 U) l x, Nwhile (!Finished) WScript.Sleep(2000); 0 U4 |* e5 J3 d& X
9 w& Q: j+ m4 C) nsimple.CloseModel(); ; [( }4 H. c" n. U3 o
simple.Quit();
# J9 D3 B- T$ e/ j8 BWScript.Quit(); 2 w7 G$ K4 h! C7 x( l
+ D! S4 ^: l1 N/ J& G+ H
/ v1 v) f6 ~- b$ m5 n0 E5 o6 M9 |' }/ kfunction RemoteControl_SimulationFinished() 8 K0 k7 t% U ?: x
{
' i5 ~# P: J/ v6 d$ S* x WScript.Echo("Simulation Finished!"); |