Example of a JScript
0 |* l; z6 Q- O( y$ ~8 R4 uvar vbOKCancel = 1; 9 h ?( k) |" K( S1 s7 d
var vbCancel = 2;
, l. u3 s: B6 F. bvar vbInformation = 64; 0 @8 Q* c& u# Z: D
var Finished=false;
+ v d% N: S* a" V 5 E' R+ C4 ^. P. I% {2 Z
var WSHShell = new ActiveXObject("WScript.Shell"); 2 G+ x- `# T2 b4 A2 g
* h2 s H0 E' f* {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , y- i& O8 U* V) a1 x* D
\: u! n1 }2 d2 d5 x7 ]( {: v$ b
simple.SetLicenseType("Runtime"); 3 r* W# U! n L4 }
A2 }$ Q. g7 y6 l' _6 e% n1 Otry ( D3 _2 w! t e/ A# { Q, Z3 { l
{ . G7 H) d2 j5 Z5 `1 s& L
// Enter the path to a model file!
0 s0 Y, }% O$ D1 m simple.LoadModel("C:\\Models\\Test.spp"); # K z% U- i+ f3 o6 Z% u. m4 \
} 8 M% |) @$ Q" m7 [ G
catch (e)
6 t) X+ k- k; T9 H E{
+ d0 X2 E; @$ e1 h WScript.Echo("Could not load Model!");
0 p: q' c, [) Q* z" j4 h WScript.Quit();
' r! P, P9 r. `7 s} 6 _8 g* y+ D8 d0 y% S: L( I% C# r
7 o; { V; i% ]* y( Qtry " O) e0 o4 e( Q3 }1 o7 }
{ * b! X3 `5 ~8 x4 D l% e
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- l- T8 e }# `4 \ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 H0 G4 S0 |4 W. C1 W if (r == vbCancel) ! L/ f) H9 W" h7 ~( {# e
{
& K* b! N+ V2 T& e& X: n; g, R# c/ _ simple.CloseModel(); ; T8 r) F& r! Z }% o
WScript.Quit();
7 t* z- ?( G. A* s1 @2 D7 X& Q0 O }
5 n, D) z2 j, `" q2 \9 |} 2 m e T! C& R
' ?9 Y4 P' A& @) l5 Csimple.StartSimulation(".Models.Frame.EventController"); 4 A0 O# c3 x* ^) E9 R
2 S) | B' s& O1 p
if (simple.IsSimulationRunning()) ! Z. a) o7 j. l; D4 I/ }
WScript.Echo("Simulation is running!"); " E7 E2 ]$ g/ P- ~6 k6 _5 e
* f. v; C1 n. ?# t; a* ?: h// Wait until simulation is finished
1 ?" Z5 x+ }7 |; {while (!Finished) WScript.Sleep(2000);
) q( D; Q/ H0 u H - Y' w5 [% x# V- g3 ^: w0 i1 W! h- I
simple.CloseModel(); 3 u5 j, o: ]( F! W4 V
simple.Quit(); , K) s+ H! t- Z* k% [$ i
WScript.Quit(); ~) S8 u8 H( U4 J0 p k' C4 p
7 D' g+ h; f& ]0 z! l) q! N. _
0 f4 j# ?! s" Vfunction RemoteControl_SimulationFinished()
* B& }( d; I! \1 x; v* c" e{
% X) F) h% @$ n( O$ @ Z* m1 Q WScript.Echo("Simulation Finished!"); |