Example of a JScript " f) N& @5 e! `4 G- e
var vbOKCancel = 1;
% S5 H$ y( J& Y, f0 evar vbCancel = 2;
3 h. @4 C* `" c) c! Ovar vbInformation = 64; , t& G; k, o. U' b/ l" y
var Finished=false;
3 _& {+ t9 B9 @ { s4 P! E' i1 g7 ~
var WSHShell = new ActiveXObject("WScript.Shell");
* F* j" X3 R. R' o+ `2 x' J. e( L
! M+ k& `% @4 ^: E# |2 Mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * q& C0 ^1 T# a! P) l( O
& i e. s3 Z& C3 w# |( a) p7 Jsimple.SetLicenseType("Runtime"); ; ^, y7 ]8 W. j+ |6 I @: l
+ r* L% ~3 ?) |$ u; |" e7 l* Ltry
( D/ ?8 } q; Z% U+ S0 D1 X{
7 L5 {* a j% V) e // Enter the path to a model file!
7 n7 z8 S7 H$ R. X simple.LoadModel("C:\\Models\\Test.spp"); : U- |' E) a! I3 P) d2 a, w( q
} 2 z9 T, E- v0 D2 S
catch (e) & d& m* U9 U) n# z6 R; s+ E9 j: W- ~
{ . L. o" V0 L! F
WScript.Echo("Could not load Model!"); 5 u8 m/ _/ H- C7 T6 a g& t
WScript.Quit(); ; N5 s; O0 J) {$ L
}
0 K) Z2 n; Z0 F- N3 z1 Y# s % c" h4 l9 N; J- X; z" x1 l
try
2 z' e! p$ Z5 ~. C2 l$ X- H{
! E6 U2 [: j- { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* n% \$ o2 ?3 |5 K2 @( b r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) U# F4 Y* f" D' W: j# E
if (r == vbCancel)
$ u" G4 d' u; ]5 ]" G5 h { , o+ h! T1 `- F# u5 x5 C
simple.CloseModel();
+ d# \! O$ v0 j; E# E6 [! } WScript.Quit();
! ^" y4 t+ y9 F; X, D0 Q# c } ) @3 W$ g3 P; a0 G# B+ k
} # ~; l7 ^ n1 Y# \& y4 I
- |+ a* ?" e( F5 @
simple.StartSimulation(".Models.Frame.EventController");
5 k0 j% b& {& E7 m) |
1 K5 l" t3 t& i# aif (simple.IsSimulationRunning()) . I9 p p+ g( ~4 |
WScript.Echo("Simulation is running!");
& p1 v1 l1 I/ T
, r% k) {. y9 Z! a// Wait until simulation is finished + {2 p& A9 Y+ \" ^
while (!Finished) WScript.Sleep(2000); $ n1 E' h2 ]7 Q6 R- X
, k5 T5 K: n/ G7 F$ y" j. o* b* lsimple.CloseModel();
8 c: y! Z, `' R$ e1 \simple.Quit(); , C* H& l& X @: R3 V9 K2 t' A) u
WScript.Quit(); ; y4 x* o( Q& E+ R' x
6 W- H# _( T" u* ^3 J0 N/ L: i
, {# ~: `, g+ V4 gfunction RemoteControl_SimulationFinished()
5 c: H3 P) ~3 w3 Z- q1 @{
( r5 [5 r) h* m: ?5 ^ WScript.Echo("Simulation Finished!"); |