Example of a JScript $ E0 E* o) k" d) A8 d
var vbOKCancel = 1; ( `6 g; L+ W5 h' x4 ~# m
var vbCancel = 2; : k1 j- E( s9 V& u) V/ D
var vbInformation = 64; 2 j) t/ y" @* q. i% G
var Finished=false; " [ E' R8 E' U/ F( W$ e. A
7 ^! E& }' m4 vvar WSHShell = new ActiveXObject("WScript.Shell");
3 ~, d9 X' x4 j2 F# d
4 [. |1 V" L, Rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 ?2 n9 ~( z9 x1 G. N" i* I
+ }3 ~& ~) K B/ o3 q8 _simple.SetLicenseType("Runtime"); 2 ?' P. S% h2 d" ?: f$ H2 A0 }
7 M1 `' o' ^/ `- Itry
" g \; q9 I: a5 l! f- B3 k1 I3 x& g( \- h{
9 e+ h' ^$ e7 ?- L( ` // Enter the path to a model file! / q9 m$ n9 ^, U7 c* Q/ d, p h
simple.LoadModel("C:\\Models\\Test.spp"); 1 G5 l% b* z9 F! \5 T$ I
} * ?" Y+ r. ~* r0 R/ j* t
catch (e) L8 \2 b/ d9 u% I9 V
{ & d# }! t" s6 w
WScript.Echo("Could not load Model!");
/ |. I; K c: N* a9 [% p6 K WScript.Quit(); # W' O) E0 b5 z0 d' U
} 3 L, T/ s6 v5 r* _2 w$ @$ S
& ]( P7 }, R& f
try 2 b: ]2 y8 t1 D: q' {8 _9 C
{ # D2 i7 u7 G. L) g- P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 e; Z+ j, R$ f6 b r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 @% M; p) H: m8 y: x if (r == vbCancel)
3 x7 R2 Y5 F) w. }" m p- A3 | {
# L7 N: C8 L A/ U simple.CloseModel();
+ S/ p! @) j* W1 p1 a3 ^$ z( d$ c WScript.Quit(); 3 }6 A2 V; [$ @( D( G9 f
} ' o3 {+ E% ]2 h
} $ A3 b( t% F2 E+ s0 k6 a: s
! m5 c! |4 P' R. l `- V Osimple.StartSimulation(".Models.Frame.EventController"); 4 O$ k5 Z; t4 w' K6 W( A S
- u( [$ S! {* t- }if (simple.IsSimulationRunning())
) D [: n$ }, ^& f; i- h WScript.Echo("Simulation is running!");
i0 F+ }8 s8 @- I/ c. ?' A 5 S4 x$ m% i$ P
// Wait until simulation is finished
! [/ |4 T3 Z+ c1 U. ?while (!Finished) WScript.Sleep(2000); 4 Q: S: _8 t, p7 a& J3 L
& n& A' |$ ]# c3 G$ V& F b/ Gsimple.CloseModel(); % l# g0 _; n9 [
simple.Quit(); " E6 J0 ]2 U6 d2 r# H: P+ U. w
WScript.Quit();
- c# _% T" ^9 h" g; E$ P3 ^ : H. Q, X( P' ^" {& r4 Y1 X2 C+ r
+ [8 M/ c* S2 G. W8 m: Dfunction RemoteControl_SimulationFinished() / n; m9 @ y5 l B
{
$ u, d- e# z. Y l) z1 d! U- j4 n2 H WScript.Echo("Simulation Finished!"); |