Example of a JScript
& i. r" Q& I8 ]+ f; g U9 t% l9 \var vbOKCancel = 1; / k3 t2 o- I0 r$ P ^% |; c. a
var vbCancel = 2; 8 P3 \8 O+ }) c, N2 o4 n
var vbInformation = 64;
" W; C$ g" e, ?/ m& qvar Finished=false; @5 e& V: A6 b9 q9 N" C( E6 ?! @8 q+ x" H
2 b& f$ I7 F7 b
var WSHShell = new ActiveXObject("WScript.Shell");
% F; n6 C; s2 @" i
, ~8 j: y: G8 S+ Pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) U T6 H' u$ U/ _
+ c, {2 A' L2 N) g; v
simple.SetLicenseType("Runtime");
; v" Y, v* B! {& x1 J q7 g8 i
) C3 E& A: k* W% M' F' s$ s* Ftry
. O% `% {( ]# Y' N, i. Z @{ 5 v3 K5 U" G: [
// Enter the path to a model file!
5 j* o: D f: Y. ^ simple.LoadModel("C:\\Models\\Test.spp");
+ w* C( M+ D9 X0 Q! D5 k! c- `5 N} ) Z9 O, V* {9 d) y
catch (e)
" }1 w! u& ~* v/ O! X4 T{ ) D$ X b; F2 E4 @. w6 D
WScript.Echo("Could not load Model!");
0 N* F% }' i. G' w% } WScript.Quit(); 5 ~+ Y/ Z# K6 b: D
}
$ M G3 R( c% r5 X7 m3 ^
( a$ D. Z" G, W C1 i stry
$ }" X% A6 P P# G: z{
9 ~) R) N7 I# Y4 z4 {, A$ \8 W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) ]8 a, o m, q+ N, [/ c" M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : o* u+ v w) W4 l% f
if (r == vbCancel) ! }2 `, Z! O* C+ [* C( f- ?
{ . f2 B2 D/ S3 }. z. l4 s
simple.CloseModel(); . Z o I. x! V" [& |. g
WScript.Quit(); 8 D4 l9 s0 S7 b0 S& M
}
7 x( t% D- R1 U) w}
! g9 v: z. y% L7 `
S8 k5 c8 s* ?7 p; S qsimple.StartSimulation(".Models.Frame.EventController"); - k$ t) C9 }& r4 Z
$ a9 _1 c- ^5 Xif (simple.IsSimulationRunning()) / s4 K; D. q& Q5 q
WScript.Echo("Simulation is running!"); * X! `& Y6 _% c1 {; f! l" Q
/ E* E* _% A. d// Wait until simulation is finished 1 j- |$ u* s8 A
while (!Finished) WScript.Sleep(2000);
4 |) y, ~4 \! @8 z3 O( H
7 ]+ m; m1 R7 i) V/ B) {' e% H- f9 wsimple.CloseModel();
# G% c; E1 ?) J6 Ysimple.Quit();
4 f( h( N/ [ L- SWScript.Quit(); 2 M9 U1 w! [0 K8 `% ` {2 b
6 R% W3 x8 ]$ k" T
- U4 l9 L7 g9 p. q* C3 H/ Cfunction RemoteControl_SimulationFinished() l# {+ y/ e8 o6 I
{
% g1 p1 l; l# D" p7 D3 R. L WScript.Echo("Simulation Finished!"); |