Example of a JScript . [9 y/ w, N; Z; J' n
var vbOKCancel = 1; + e% v |6 m' \" ^7 i
var vbCancel = 2;
8 U8 L L& \2 {; `" R" Svar vbInformation = 64; # h# e3 m6 N$ E G" v9 D, u
var Finished=false; : }: ?' q6 X \6 {9 c7 h* N* r
1 C7 J) I; R+ Q$ t1 {+ X# N+ ]
var WSHShell = new ActiveXObject("WScript.Shell"); & ]* q: @6 l8 W; N+ F; g+ J [
! z7 X+ x9 m# q0 A5 i" L% P# a! t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 G& c1 Y) [+ w) o) Y
- m/ A& q5 F9 e' Xsimple.SetLicenseType("Runtime");
9 H, I- e( N. N1 C e
& R' e2 R1 Z7 h" A, Z/ D: v( Ftry
. g9 A/ }8 t/ C$ f- i' b: \( p; Y' q `{ ; V5 Z: x8 l/ D, k
// Enter the path to a model file!
# c5 q: g% L( A, B# I* T simple.LoadModel("C:\\Models\\Test.spp"); ) S) O- V; J' B8 w' K. T
} , v% ^) L0 U( ]$ G: H" V9 @& }
catch (e) 5 v5 c( m+ l8 V5 H8 w; x" O7 h, E8 [! c
{
0 Y% d/ X, D' f* X6 p* _' E; ?/ b WScript.Echo("Could not load Model!");
1 G. r; }0 {, E WScript.Quit();
7 y* O5 Y( ?: o/ ^3 |1 \ D} - G. Q! C" g* g: h0 [
3 o/ G5 F+ i6 h" htry 1 |0 h8 Z/ g; Y, c {8 T* Z
{ 1 I. j" L- e: z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 p0 i+ e S& F" W1 N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! J) t. J$ o1 ]
if (r == vbCancel) & T$ C( V/ N* M
{ : W4 v! H4 Q) w( M
simple.CloseModel(); $ m! _' y# z, x2 s0 x4 j. m7 b2 k
WScript.Quit();
! w6 |+ w* B# ] }
- }1 y# J- k9 | `% h}
8 u N* }4 M& ~" Q1 p- E7 |. \# e - \$ x# S$ b v* b/ A
simple.StartSimulation(".Models.Frame.EventController"); 6 V1 \/ r" d' s5 Y" t
5 }; c% H' M% L/ X% W0 u- sif (simple.IsSimulationRunning())
% R% g8 M; l: _. u0 s WScript.Echo("Simulation is running!"); 8 r3 ~/ a" W. i O% T2 b
2 V& x' z. g5 w, t
// Wait until simulation is finished
( F E( U' ~2 |while (!Finished) WScript.Sleep(2000);
. `- n3 W: Z* J' h ' x: f4 R9 w4 S+ _
simple.CloseModel();
* P- `% E5 T' f( g* xsimple.Quit();
; j3 ]7 {2 P0 ZWScript.Quit();
/ M% A R, m- T# d9 M! r0 o: L/ k 7 J8 [' P- v2 |" G0 h% v
0 o% R" u9 u9 P4 Y5 K, qfunction RemoteControl_SimulationFinished()
$ O' x0 V, m& {, T6 j! N{ . G* @( e+ H, \. _, K* n( @% h
WScript.Echo("Simulation Finished!"); |