Example of a JScript
! b1 n2 C* D$ Zvar vbOKCancel = 1; 6 P: Y: }) m/ {* M* I. ] o
var vbCancel = 2;
3 C0 N& a; r# h+ \- _; S& s+ f! hvar vbInformation = 64; , k$ D- q1 p" G9 k3 `2 H
var Finished=false;
1 X% Y. Y! [2 L! U. N7 m8 s3 ^& h 2 c W7 n* G) w+ g
var WSHShell = new ActiveXObject("WScript.Shell");
$ T8 u: s c2 J- B/ T1 I( E* b & b) w, w) O n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 `& Y: e$ b; R0 k! H
: T2 F7 z: m# P% Q' ?simple.SetLicenseType("Runtime");
) h8 Y4 o' A# o& [0 F8 W " c- O! G* Z! J O9 [
try
3 V1 c1 u+ ?- ]6 I{
: s- w% i& W2 d! w: Y2 }. n // Enter the path to a model file! # _/ r; u3 E. L( @" a
simple.LoadModel("C:\\Models\\Test.spp"); ! S) R7 }7 w7 F, r" a
} + ], }/ o4 T' c4 v7 V
catch (e) + `5 E( a; z" a8 S) H8 F9 [" {4 X
{
' D5 P* ^7 _3 p/ A1 r- r WScript.Echo("Could not load Model!"); ' u* o) V' a9 {* u6 H
WScript.Quit();
1 z5 f/ u6 C9 j- h} % v: D$ Q$ T1 w. L
* s$ z o$ q- I' U: ~0 T
try & ~& A; T: O% [0 Q1 W/ \
{
8 j. k' B' C* r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" B' G( P) {! }9 X$ E# k* A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 K# j; U" j2 ` Z; i if (r == vbCancel) # ?5 w9 V6 d7 h& H4 c8 a; b* n
{ 8 B+ d# s5 l! x3 W
simple.CloseModel();
; e) p" j% | b% b& j WScript.Quit();
2 r; d% a: B& J6 X: \1 k4 R/ @ }
; E! m6 P3 `+ o4 n8 T* W9 L} 8 p" c- E8 S% T" X
3 h5 N/ D0 D; r6 e9 }; X b7 ^" @simple.StartSimulation(".Models.Frame.EventController"); / c6 e/ q9 O, d6 O- n% g) l
8 x. U2 z, p2 A# qif (simple.IsSimulationRunning()) ( ?3 N) }" z& q" J# U/ c2 ~1 G
WScript.Echo("Simulation is running!"); ' _% Y6 E3 v$ a+ l8 ?
7 `" Q: Y/ U$ v// Wait until simulation is finished
G+ L4 H, f2 y1 Mwhile (!Finished) WScript.Sleep(2000); - D1 i) @# w r* ~4 V
: O( h+ b8 O4 X! w" D3 Csimple.CloseModel(); l' v7 N8 T% l6 Z$ C; }" I
simple.Quit();
& t2 }) g2 T: E! n4 hWScript.Quit();
; {/ [) {% Z( o4 e8 F- [& V
: b$ x, [6 V" `/ \- z + `* v9 G) {5 p3 n$ U
function RemoteControl_SimulationFinished()
! f3 r# h% T2 q{
# ^0 f6 i$ N9 Q WScript.Echo("Simulation Finished!"); |