Example of a JScript
! ?/ i* ~! Y8 ~2 Z* yvar vbOKCancel = 1; 8 g4 _( b3 W# r$ ?' ^; A
var vbCancel = 2; ! `! R( }6 W# Z2 ~# ]9 y
var vbInformation = 64;
+ P5 o1 \* b9 \; w4 V3 q/ v# W- _var Finished=false; " X8 b% l, `) ~0 v+ f% m
$ f, g# Q' f' }- T
var WSHShell = new ActiveXObject("WScript.Shell");
8 x, a3 c4 b& u/ y
# R+ G/ ~2 ~. nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! R4 F! v9 {' {4 @( h3 K : T% M' y6 w% {: G- G6 s8 `
simple.SetLicenseType("Runtime"); : i, q' ?* D, Y0 k, i. v' ^! B
5 b: C! e, d a) k/ q7 Y
try 2 F: ?2 f6 x) x K2 F
{
. u. G( Q0 T/ B V" @ // Enter the path to a model file!
2 N( g$ c9 Z8 e; l/ s* s$ S8 @: x simple.LoadModel("C:\\Models\\Test.spp"); + o; z/ G6 h8 c6 n/ m7 v; _
} " `* q. L# C, h4 c6 q6 h
catch (e)
/ c; J r; g7 m4 G0 o3 Y! ~ ^& b{
7 q5 ]% \& r, n# ^1 e WScript.Echo("Could not load Model!");
) q" L& g( Z+ A WScript.Quit(); 1 w1 R+ ?- c. q* g
}
* W2 z+ F# A9 |& O; f) h% Q3 {' P : e5 Q) I6 }+ z) a2 w
try 1 Z; _$ K" k" ~0 R
{ + M+ ]) z3 H! E" z' r# d% i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 N7 C2 ]! f |. l; _( i" B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 @# K5 p" v5 s" ^' J/ L0 e
if (r == vbCancel) + ]* ^ q" B7 o( Q. I1 R$ d
{ , h* D* R+ z1 i1 m1 H
simple.CloseModel();
" |" [' u5 ]" I+ M, M- t/ h WScript.Quit();
& O3 ]+ l: r$ h2 F } 1 x0 h+ J: P9 Q6 i7 I) J
}
) |0 h! f% {9 O2 u
4 W1 R: G8 \. ]; g& y7 o: a* Dsimple.StartSimulation(".Models.Frame.EventController");
7 }$ S! T7 U" G: n5 G6 y 0 ~ N3 T d2 h2 k5 {
if (simple.IsSimulationRunning())
9 W7 y3 |& |0 L, B5 D8 s# n WScript.Echo("Simulation is running!"); 5 ~2 D" t+ H( Z
3 m0 i U2 L: n7 | H: ~
// Wait until simulation is finished $ s2 V9 Y9 A1 t7 `5 F8 e& u# |
while (!Finished) WScript.Sleep(2000);
8 ~' I4 M `4 R- u& O& o \ / N' a9 y7 b4 E/ R
simple.CloseModel();
7 s3 k Z, L% a' \2 Zsimple.Quit(); 8 g2 _3 S( A6 D& L# h
WScript.Quit(); 9 N, Y( r7 D! x9 k) l& j8 o
1 g4 x- X) K& _" m7 V% Q0 B0 G, J8 r* j8 g
% ~0 ~3 C3 n7 t8 k& ?function RemoteControl_SimulationFinished()
. C( A j) c2 f G- Q2 Z9 G{
+ g, |3 L8 @0 V. \( A WScript.Echo("Simulation Finished!"); |