Example of a JScript
- f% m+ _( X- X$ |var vbOKCancel = 1; ) X7 ^6 p8 B5 x# V7 j
var vbCancel = 2; $ V1 R* ?! Z) K6 B5 \
var vbInformation = 64;
* }; ~4 K2 _; b0 v, p0 p$ \& Q5 \var Finished=false; - i! ?' B; l2 `' i# M( E
( n6 s+ R7 M7 {6 l: Vvar WSHShell = new ActiveXObject("WScript.Shell");
5 Q; L2 l- }" _1 S& q " o8 x4 b! O6 o# ~/ A. U+ \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& {; ]3 w2 T6 t' j5 h ( f4 S$ `" q5 w8 N; {% Z, x: a
simple.SetLicenseType("Runtime"); ) x5 f, i' P5 _3 X( C
5 p7 n$ i" x& gtry c* E; Z# |$ Q/ ^- _ M3 W
{ + I& k5 }. ^( h% K8 I) s
// Enter the path to a model file!
# K" U: d/ A0 K, s& }2 y6 r+ y7 J simple.LoadModel("C:\\Models\\Test.spp"); . O7 X3 t. C# Y$ w- v3 w
} 8 q& o. a+ e# g6 `1 P8 n. b
catch (e)
" V5 G3 I. A( W0 d5 r5 f0 M9 p0 @* y{
" {! ?$ y: L! }6 Y. W WScript.Echo("Could not load Model!"); ^7 R" X m& H8 Z0 q3 G* m
WScript.Quit(); 4 Y6 E: k# P Y- w! n6 r5 U
}
5 Q( H8 P4 D& |% e" [8 Q
5 L. a% V# V7 K' Ptry
) g. @: U" R& J" c2 ]9 C! o4 a" C{
+ X7 m6 q" B- L5 X. b, ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( r( {+ h' e9 m$ }4 Z7 [) ~ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 ]/ i3 `2 C- C
if (r == vbCancel) 6 b2 u1 t6 @0 _
{ 5 ~( d. e8 s, x! y7 X
simple.CloseModel(); 6 G. C$ Y% v; M4 x2 G
WScript.Quit(); ) A4 {0 w. h! U* R5 k3 F- H
} 9 [) l7 R1 \3 V _9 N3 d! X
}
( ~1 H7 F6 I5 r. \
# Z U/ P$ l' t* H9 w/ Xsimple.StartSimulation(".Models.Frame.EventController");
5 U: f) D/ k4 I% ~2 F - V8 n4 }: Q1 u9 P( `+ B3 m3 Y5 U
if (simple.IsSimulationRunning())
0 f7 a4 q" {6 v1 g) D( A, I WScript.Echo("Simulation is running!");
! j3 w# d- X! v7 i# S & B9 ?) W* i/ ]/ e& Y( `
// Wait until simulation is finished
7 ?# O. ^, H* l- ?7 r! `while (!Finished) WScript.Sleep(2000);
5 K; G, v. j/ l ( w" b& q& i1 B( b. r# ?. a, {
simple.CloseModel();
/ u8 }$ L, z& ^simple.Quit(); ! q2 G- u3 z o6 H) L
WScript.Quit(); 3 K' ^2 O; j: H3 \. G! i1 _
3 I+ C8 h# h- @- n# N2 C( H
3 O2 e x d, F5 P2 C7 qfunction RemoteControl_SimulationFinished() u* U6 k& a$ O% K( X
{
& {5 ~$ l( S3 r3 h2 A) f WScript.Echo("Simulation Finished!"); |