Example of a JScript 2 Q" R! r% d8 {3 Z! k5 k& _. l" z
var vbOKCancel = 1; 9 ]5 e* u" K/ A' X( N/ w, w: n& l
var vbCancel = 2; ! C/ A. A- W5 f' Z6 F" D2 T
var vbInformation = 64; 2 [7 ]/ L, V% n9 w) ~2 k- P
var Finished=false; . p; L. h- f+ M0 Y
* ~8 \0 h+ L$ S$ [. u3 b
var WSHShell = new ActiveXObject("WScript.Shell");
: l6 `4 }3 ~% _! O- N " `$ {3 n1 g8 l
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 w, H) H: ^2 w8 X$ L* `
0 A9 ?0 [4 n- s- a+ `9 Asimple.SetLicenseType("Runtime"); 8 F* Q9 h8 @' y, l9 D, G" `' {
8 t/ \" Y% z% H# p6 |2 O) @- h# r# K
try / r8 n" y( `/ X
{ 7 [4 G7 i+ | H& j
// Enter the path to a model file!
6 |; t0 W- h& b# y& \ simple.LoadModel("C:\\Models\\Test.spp"); / k+ k! Q& {1 N) r! v
} ' L% n% O. X7 e: o) Y
catch (e) , H. S% _, F) s; S4 H9 ?% R
{
/ {0 C" }+ n$ x$ X9 c9 t7 C WScript.Echo("Could not load Model!");
2 v7 L* Z% a; W1 ] WScript.Quit();
3 l5 ^, L- `5 w- J: ~7 t} 6 b' ~6 ^2 j# E d& m# n X ]) O
/ f3 U9 t: R/ n; U' u6 I
try # q, z& {( n1 k/ {
{ r# @( i7 x( Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ O+ s( [( n# k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 ]# j8 V5 K+ z if (r == vbCancel)
8 ~1 k; ]5 Q- Q& P% O' _ {
4 _) q! c i+ q$ A simple.CloseModel();
" Z: R+ z3 k" \: F) O" |3 L( q WScript.Quit();
& Q0 x# v7 x- ` } 4 R) p7 e* i! \( Q/ ]. r9 M
} , @8 ^3 y; H' T$ l* v. o2 L( T
, B- x8 [/ K$ V5 J* M5 _" dsimple.StartSimulation(".Models.Frame.EventController");
2 ]3 X) f: Z& z 8 V' ?6 t# r( S4 |
if (simple.IsSimulationRunning()) 9 |2 w; q: c/ U1 w1 ^; ^
WScript.Echo("Simulation is running!"); 4 a' O4 c) @0 [4 u/ Z# t/ d
# Q8 v* B5 d/ l2 W( g4 o5 h// Wait until simulation is finished
* o9 E" w6 v/ U3 \while (!Finished) WScript.Sleep(2000);
4 p7 S9 B- h# s4 l" ?0 S; u/ w5 |- W 9 s2 v2 V* I. d+ O
simple.CloseModel(); : J! l6 d l% k0 `
simple.Quit();
: z& y# [* Z3 X7 _0 n9 PWScript.Quit();
5 |; }! s( C7 B C2 Y7 U' ?
8 D ~6 ?2 K- z. ]
' E- g7 g3 R. g% D- bfunction RemoteControl_SimulationFinished()
% N# c$ p4 z3 @0 z$ j& X- q{
% J* I% g/ u" B# K. t3 ^+ | WScript.Echo("Simulation Finished!"); |