Example of a JScript
" S! a- C- v# p1 ?5 x/ ^9 n1 R d. Uvar vbOKCancel = 1; & L, M2 q% C2 S) n5 z# ?
var vbCancel = 2; * h; P' g: f; `2 F6 P
var vbInformation = 64; 6 \2 Y' n! z; o) Z. y
var Finished=false; 3 O3 C4 b% z3 A6 a% g
0 y$ P. E0 a7 @1 [0 s6 c: @* f
var WSHShell = new ActiveXObject("WScript.Shell"); - A6 O4 o! ]0 k
6 \# E. k ]5 N' [var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & B9 G/ e& [7 |; @
8 r3 u! C9 _% s2 I" [+ {1 L L
simple.SetLicenseType("Runtime"); , @. |9 n6 M) V( t; s* F# \& S
3 x( l! A& m& b$ J7 Q! |0 Htry : |' Q B2 N, ~2 \+ j
{ 3 R& M. z, \$ @# \
// Enter the path to a model file!
. G u5 r {5 w2 k t* m ~ simple.LoadModel("C:\\Models\\Test.spp");
/ q- R& G1 w Q6 V! s- n8 Z}
# D: I2 G6 J3 Lcatch (e)
% I% Q: x* }) w! N{ 7 x# l; g6 H$ r8 J( }3 } z# f
WScript.Echo("Could not load Model!"); 7 P$ k; [ u" L
WScript.Quit();
, s- `7 P' I6 j L3 [2 m4 p7 q}
+ E$ r" J' h" p1 D f" g _1 p
2 F6 b# x' R( P4 f( @try + Q* U7 a1 O$ M) y6 @: i6 |
{
, ^! ^, K7 J- f0 m. K4 @- ]. |2 I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* E; @$ i. O' S% D. }+ \ ]; S$ B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) E- N! s6 W3 @- d0 y
if (r == vbCancel)
3 m$ l6 }' b5 m* k/ x- J9 m \. ] {
8 ^1 C! X3 h& U' e& ^7 D, h simple.CloseModel();
. k- P' W* y' _: L3 g! q' ]& ^ WScript.Quit(); o& o) L) ]4 T: q
}
! y( s8 y% q1 e5 [0 z} / ]7 E; B; C7 j- E2 j* G. b0 l
/ k2 b* Q- ?7 Y# Vsimple.StartSimulation(".Models.Frame.EventController");
1 C% C- U3 J; w
8 E6 l3 M) n9 u3 Zif (simple.IsSimulationRunning())
7 J# q. D; _: m- \& F. E WScript.Echo("Simulation is running!"); ]+ D0 L; o9 J) M+ F s/ U
, T7 V# T( v; }% d2 ?// Wait until simulation is finished
5 Q, g( u5 s1 C" _1 l, u+ Swhile (!Finished) WScript.Sleep(2000); - H2 Q+ j& g5 M$ X5 u
5 T( L5 K# ~# {$ `* |simple.CloseModel(); : D5 K% D" {( t5 ^
simple.Quit(); # L7 y' ~7 b9 v0 J5 D
WScript.Quit();
7 V1 U, L9 u) `9 f& }7 H9 i2 e4 ` z: n/ ~9 S1 _
) }* b5 X0 K2 l0 J% y: C
function RemoteControl_SimulationFinished()
4 Y$ ^/ K" L0 _( ?' O: i9 w1 M$ H{
# Q2 D2 s4 X& O9 O WScript.Echo("Simulation Finished!"); |