Example of a JScript / q- L0 k3 n. R" h7 ? ]: G' s- o
var vbOKCancel = 1;
$ q3 D5 P A5 R0 jvar vbCancel = 2;
+ M( m' o" _1 W- e& lvar vbInformation = 64; # f$ x- z* v: \# \+ k
var Finished=false; - O8 [$ O9 ~# L1 h: o
3 [& c% k$ M3 h- V/ b5 J, u8 @var WSHShell = new ActiveXObject("WScript.Shell"); + {4 L6 ~$ ~4 D
, R1 D7 f; e# J" Z1 A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) J- K8 I) L+ }% C+ `* }# L
4 q3 \* @+ J; c3 ssimple.SetLicenseType("Runtime");
) A) o/ U$ f# C0 [2 L8 z7 E
1 b5 o2 g4 f' S( C. o7 Ktry
* D8 S0 K( P- H& o+ K{
; g; G, p$ i" e% o // Enter the path to a model file!
* J! E7 ?" g# ~ simple.LoadModel("C:\\Models\\Test.spp");
+ E2 j9 q( [$ [9 h3 k: b* I7 `+ w, h' a} * m) N! I# N. }; y5 T. z
catch (e)
- H- E3 M/ a Y( c8 U4 B{
1 y# U* L" c4 v. ` WScript.Echo("Could not load Model!");
4 q) G- D% p6 ` WScript.Quit(); . I5 U/ E( g* [. T
}
! u1 Y5 O: ~" s- F ?
, @, X+ k3 @3 Dtry
3 E6 l7 s( i4 t3 @& L |* Q0 _/ o{
0 H3 q) b; d- M i; m7 a6 i4 i simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 x2 x9 Y. K( O/ t ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% f. Q9 ^/ b- T7 k( O& }. X if (r == vbCancel)
# D% y+ |# {7 X. d5 o' ` {
; r6 t2 r, q; I simple.CloseModel(); . H% S1 d6 M9 p/ @
WScript.Quit();
9 u6 C4 g0 `& u3 T9 E- ]. u2 ?* B9 g }
! I5 B0 C5 t$ w3 J+ r) _6 c: t}
7 @" j: T1 `+ \3 R' D* e 5 ]3 u# ]1 V% R1 M
simple.StartSimulation(".Models.Frame.EventController"); ( |5 ?( n5 H2 c
# R* C) ]7 O7 z) V/ s
if (simple.IsSimulationRunning()) 4 e& |9 Q# i( u9 H: N F
WScript.Echo("Simulation is running!");
9 V6 }7 B, f9 w$ @( | ' L J- ^! R9 ?8 \* s; C4 C
// Wait until simulation is finished
& ~3 Y/ w7 i* D9 J/ k5 _# wwhile (!Finished) WScript.Sleep(2000); , }+ f9 p0 r0 k o1 }
" D9 i; o A x0 I4 w
simple.CloseModel(); # ]/ ]* N7 [# y0 x, R, R
simple.Quit(); ( P1 N, e' d" k, x* @1 k! l. v
WScript.Quit();
- U- O5 l6 [/ J( @ * [5 i& V& p9 I, `! Q ]0 _% c5 V" q
1 A: P/ [& v5 u3 q. ?( k# Ufunction RemoteControl_SimulationFinished()
7 R/ {* h& H! X4 B8 {{
4 T, v- J: M, E9 n4 r WScript.Echo("Simulation Finished!"); |