Example of a JScript
6 E& s1 o! ~6 J, v/ Fvar vbOKCancel = 1;
" u8 o) n/ s0 y* E- a" Evar vbCancel = 2;
2 M V8 S" X O4 n6 ovar vbInformation = 64; , v0 C- K( G- w! i3 r
var Finished=false;
6 ]8 G- \4 `4 @" W
2 }% x5 B4 F4 u& g: M! p6 [, uvar WSHShell = new ActiveXObject("WScript.Shell");
4 l3 w/ C/ i$ O* E + Z7 d' Z0 t6 c1 _* ?& A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' q% Y! d9 F, }8 r+ l
, G _# L1 l$ @! e. a6 F
simple.SetLicenseType("Runtime"); ! n3 i) i9 e' E2 t$ H9 r) T( D
0 _1 x; D" w4 I& o3 T, G" v# |; }
try 3 m, Y% J: D8 C4 H9 ~6 B7 c0 D. H# T! b: j9 }
{ + [. u) O+ ]3 p% @8 P. M% T7 b4 V
// Enter the path to a model file!
3 S6 b, d0 k: y7 t/ l* c simple.LoadModel("C:\\Models\\Test.spp");
4 y P9 S2 Y9 O4 G* m* a; \6 c. w} ) E p3 _' _8 p) B7 H
catch (e) m4 A( q. X: u
{
0 t7 z2 q2 L q& q WScript.Echo("Could not load Model!");
* Y! G) e* ], N: B. p' z* X6 U WScript.Quit();
& m3 g/ j/ s: _ {3 E}
/ X& x+ i+ Q; k % g& |6 ]7 A4 F2 S; H. k
try
^) C" p7 U, @- O{ ( E# U; b# f3 r8 ^! y9 ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 j- G4 n6 ?) Y u9 Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# j. U; a+ v, K if (r == vbCancel)
7 ?/ m% [% T6 B, {9 Y [ {
$ _. X* U3 L# @: t7 z9 Z simple.CloseModel(); 3 J) D& i5 X" ~
WScript.Quit(); ( _& `: u' _8 u+ }
} + z# R% ~# m; K% k
}
) c9 G& k7 c: ]# v6 s7 e1 C6 d. }! D+ w, N
# R2 s4 Y6 M, Fsimple.StartSimulation(".Models.Frame.EventController"); ; w; y% l3 u: E8 M" s/ [2 s
. \, T! w( F& l8 H# Aif (simple.IsSimulationRunning())
9 q3 T8 K6 O2 m- m+ {5 e0 e WScript.Echo("Simulation is running!"); 0 F \' U+ i, I3 B1 ~# ^% w
7 a* y: u' X8 `; _5 g9 l// Wait until simulation is finished 1 E7 X( H- a. p/ S8 \, e
while (!Finished) WScript.Sleep(2000);
A' l3 P% n8 b* @ ) i- o/ E" C; u* @6 x# |
simple.CloseModel(); 5 d9 |1 f/ X0 M
simple.Quit(); / Y9 a6 J9 y; I
WScript.Quit();
2 u9 E& B2 A1 b8 R6 S- J
# P5 X& j7 @9 V- K
+ @9 B1 n3 w& |) f2 b8 n: Rfunction RemoteControl_SimulationFinished() 5 q5 _& R3 H+ R& d( C6 B; L
{ ' L, Y @( B" r
WScript.Echo("Simulation Finished!"); |