Example of a JScript 4 v, H# C6 j7 B& h, _3 ?
var vbOKCancel = 1; ) Y: m7 R8 o. y
var vbCancel = 2;
+ G" g' H2 V, l0 | Fvar vbInformation = 64; ( r1 K: H: {% ? Y' C0 A
var Finished=false;
% K. h4 F, L o5 r
6 N" {1 w. B- Avar WSHShell = new ActiveXObject("WScript.Shell"); 8 S* A, H/ [& R. [& E+ P# `
( Y0 ~; k: C$ a2 ~: v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ }- |: U! j1 W* A8 _
$ q7 l' r+ o% l
simple.SetLicenseType("Runtime");
0 F9 p' E K$ E/ r4 }# Y
+ O" G# b# g/ K" ]" _, p4 Itry " t6 j' c7 l- r+ D9 o" b L8 C) h
{ - |5 E# J% m4 x
// Enter the path to a model file!
Z( K' `9 T5 c: K3 U G% x simple.LoadModel("C:\\Models\\Test.spp");
! v. R9 Y4 G* ?" C}
, ]0 s7 X y$ Dcatch (e)
V. S5 ]& y' H% ~{ 8 d* J% F0 Y* c/ z- z$ }' Z
WScript.Echo("Could not load Model!");
; S$ i, ~7 w0 d' y. c WScript.Quit();
, P" u. }6 B; ~1 m! c" ?. V! D} ! u' Y5 y: z2 r. W+ g" K3 e7 N
/ N+ e; T2 J; d* ?7 V: G
try 2 v* R# n- s* v/ _. q
{
2 G( n9 Y: c; m/ V. P' x7 j' }, e0 c/ X simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- M1 j0 _1 b0 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; v2 S- a3 H2 W! G8 z* R& p8 [( N if (r == vbCancel)
1 ]* o/ f5 `- g2 L' a {
s5 J3 q( P% z3 w simple.CloseModel();
% v: p1 D b' b: }( `, q WScript.Quit(); 4 F0 x) ` B( _. r0 e
} + A0 B- w; c" }2 q# C
}
' k) V$ K6 j) }* t) _* Q0 q @: f
' f$ t, Q |4 W) L" W/ Fsimple.StartSimulation(".Models.Frame.EventController");
! R% a, q3 H: F" S' ?7 a+ Y ; j! J! ~$ }$ t2 _2 U0 `* q8 |7 n3 f
if (simple.IsSimulationRunning())
5 Q- @+ g0 p* P0 a5 R; C( q: N$ A: \ WScript.Echo("Simulation is running!"); , |: R6 {; e- x! b7 C
9 l+ \* l3 ? d8 h* z// Wait until simulation is finished
: \6 m- ^( I* A+ i# X, f* ?while (!Finished) WScript.Sleep(2000);
B( h6 y% i# N: Y7 u
- @* r8 r8 D" s, o" ssimple.CloseModel();
# l; z/ y* e' h4 M% y6 o" `& x2 I6 usimple.Quit(); 1 l/ V, E, {/ r' b# d2 X
WScript.Quit(); 2 Q9 \7 {* |: Z6 V5 p
+ [$ S! ~, u) O" I: [
) \; }) l2 \0 w; f! a; rfunction RemoteControl_SimulationFinished() 7 {) V& x% H* w
{ ( j- y) g# v# t" V
WScript.Echo("Simulation Finished!"); |