Example of a JScript ) F2 X3 w9 D; F8 X% y
var vbOKCancel = 1; 5 y1 F8 y) u4 B) I8 }, z3 V
var vbCancel = 2; - i* j0 _0 |- n% l5 J( C
var vbInformation = 64;
1 n& s3 Z$ V0 c1 b! K0 wvar Finished=false; : [$ m/ {1 m+ O- [% i: L+ a3 X
" U. L' n# H8 N0 d9 Z0 t
var WSHShell = new ActiveXObject("WScript.Shell"); ) f- e3 J5 t% B% ?" g; |- t5 ]
# K$ V" G, i- z" Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' h1 q9 ?# l3 q. y- F
% z: X* Y+ [; c0 t; r/ A" g3 Bsimple.SetLicenseType("Runtime");
1 g: _% _' U) J: q
5 }" j8 H( T* A& b) S7 _try
# x: t2 E7 ~' @5 E, _4 W{
" j' M! k c5 N; ^ // Enter the path to a model file!
* X6 v% w+ }5 o5 B1 S0 l: G. X simple.LoadModel("C:\\Models\\Test.spp"); ; i5 G1 s: Q" Z8 ~
} , |4 Q& N+ R9 P
catch (e)
; e* I3 w: u9 d/ k' ~{
+ I( A W" \# N+ @ WScript.Echo("Could not load Model!");
1 c, b: h- q3 V: ` WScript.Quit(); ( Z+ S `* F" l. V
} 2 g5 U B c* a: u7 r
" Z) H$ ]6 h: o- Y8 h2 D8 F* [
try 0 I! Q) I+ Z. u8 r& `8 K
{
) U& X( \1 G& C/ M+ `7 o1 ? simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " R0 B5 d) _( U( b1 s
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& q# ]9 _# K" @8 [7 Q. Z( m! H9 k if (r == vbCancel)
/ y) b) A# ` ?( o, y/ V( S- Q {
( Z1 E4 B6 n/ D simple.CloseModel();
6 ^9 E9 m' w$ y' r; T WScript.Quit(); ! W! [' w( S; C+ C" ?
} 4 A9 L* `: h* N5 u
}
2 a1 U. P. @$ g+ h
- o9 U' [/ t5 z) l* x+ O. Dsimple.StartSimulation(".Models.Frame.EventController"); % ~& i/ |+ k; j, u# @0 T0 q" `) ~( I
# }1 z& F( Z+ Y. V1 ?if (simple.IsSimulationRunning()) : g9 Z- t; W, Y) H
WScript.Echo("Simulation is running!"); 9 b" W2 N/ e! `7 c a
% s" }* |; @# G6 B X! c( T// Wait until simulation is finished
, n5 r0 t% E# p2 R7 ?& x( f. D) _ Mwhile (!Finished) WScript.Sleep(2000); : X9 ~* D( E% l8 R0 H$ a9 D
8 S# f) e6 E3 X5 }; }! j
simple.CloseModel(); 2 u: S r1 Z2 i( `, h9 {
simple.Quit();
) J2 r; \" ?, H8 FWScript.Quit(); : ^% c5 D9 w7 k1 L
1 ]% @! L2 |' ]( s8 ^5 E- @. Q
/ l. Y+ W3 d# l: L+ \, E3 \9 xfunction RemoteControl_SimulationFinished() 5 a8 p. p1 v) V3 _
{
j, {; b7 A* y! z; p WScript.Echo("Simulation Finished!"); |