Example of a JScript
3 w- f# ~8 W% Z4 K( Qvar vbOKCancel = 1;
+ H* v/ G2 ]+ x5 i/ o) x1 q3 Y4 I, tvar vbCancel = 2;
5 o& g' l2 j$ gvar vbInformation = 64;
' V# }0 l# H `- H9 }, ~. Xvar Finished=false;
1 L! o/ V, [- C" u7 f ) U' _& H7 n7 K8 H4 @9 D
var WSHShell = new ActiveXObject("WScript.Shell");
: h9 D( Q; v' ^5 Q) t8 m 4 V( {$ q8 }1 M2 `; w3 {4 J5 {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 N' X+ \! I5 ~+ M7 X * o: \ L S* J! u1 f& ]
simple.SetLicenseType("Runtime");
W5 H; ]0 `/ m, {- R8 O, O
# ^# G; c0 K1 q& j! w stry , }9 z, j, t# R& W
{ ; }3 g. E8 X4 k! ]2 k: y
// Enter the path to a model file! 3 j& R- P3 C& \$ ?4 @9 |9 X* ~0 J
simple.LoadModel("C:\\Models\\Test.spp");
( @( g$ L# }/ K+ Z' {& J} " [ ?* p( {! K7 |2 h
catch (e) 1 V. `( E b0 b {
{
4 X& }' s# _/ Y WScript.Echo("Could not load Model!");
9 ?" l5 B) |3 t+ @) y WScript.Quit(); ; X& Q# y! q, w7 m# A
}
2 o6 r6 _% x1 L
/ V# c! a' `# J9 V- _try + Y+ B% f. B+ A1 k& \3 U0 c
{
7 \, O% M" h7 D( x7 T0 J0 g simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 p0 \: d- }1 j3 j0 |+ g. Z+ E: w
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * k, }- _/ }- u% u) d* N- T
if (r == vbCancel)
2 g- f7 G; V3 W; n1 E7 } { ( A) A- c [$ L' S z% Z
simple.CloseModel(); & |; |8 t& z+ a6 c# K- x
WScript.Quit(); - N5 V5 |, `. g
} ; e% k7 T" y3 P& O9 p' V* m/ \
}
1 e: g. E( e! G; M0 y ( y# b/ `, m o6 k
simple.StartSimulation(".Models.Frame.EventController");
- [7 a: n* ]: ` D$ `! n + P' A: b! @4 S& i% v( }+ X
if (simple.IsSimulationRunning())
' F; w1 }& z5 J- m2 F" m; f0 `* c4 V WScript.Echo("Simulation is running!");
; [, g5 X9 j B" p + W7 p5 { Q! r6 s# ]$ W
// Wait until simulation is finished " }7 y1 h0 S0 g. ~8 @/ C
while (!Finished) WScript.Sleep(2000);
. I: v5 P( Q% s+ ^
7 f+ G# e& h k5 c0 t, csimple.CloseModel(); 2 X M5 E- C$ d' X7 w& j
simple.Quit(); 6 Y7 L1 g: H( |& y& b4 z
WScript.Quit();
5 c/ T; n- D+ ? n & t! V2 {$ A0 X% Y" `/ q, {
, u7 }3 e3 i. k; lfunction RemoteControl_SimulationFinished() % M% ]" P9 E- D, j0 }
{
3 `7 r$ V, L) R WScript.Echo("Simulation Finished!"); |