Example of a JScript
/ `: p' D4 w o) E7 `var vbOKCancel = 1;
+ f3 p. g6 m% Ivar vbCancel = 2;
. X1 T6 P* T4 w% tvar vbInformation = 64; , s( J: N, U2 D# @
var Finished=false; % z" i6 U- _- y- D
+ V7 ^7 O0 q1 } cvar WSHShell = new ActiveXObject("WScript.Shell");
+ z; `5 I: }- I; w+ Q; V 6 {$ N: C" D4 c
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) k- G; D3 K8 e, M
' v2 S) `5 U4 M/ s+ qsimple.SetLicenseType("Runtime"); / l6 O, c6 t/ p4 v7 r
& G6 [' c7 U! E* W( j; N' J0 S" gtry # x/ L' y6 x. T! N: \+ z
{ 9 J! E r9 z3 H/ \0 C# _% e, N F2 x
// Enter the path to a model file!
; E& M* n- G7 D, [- R' A simple.LoadModel("C:\\Models\\Test.spp");
) f. |9 H/ ]4 Z: `. v, g} 8 S9 U$ `* W5 Z5 K
catch (e)
5 h2 H1 F4 ` }& H* b' P{ 0 b. |$ I& N; U# V
WScript.Echo("Could not load Model!");
4 i) B# M" G7 {- Y WScript.Quit();
+ C( y6 x& s) m& O} 9 a' B8 w6 l% W2 d6 ]
. p) R) p+ L4 K* H
try
, H6 S* W8 F+ `+ R1 N6 E{
8 B9 m3 k$ N, e {9 }, ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 t: O7 x9 w5 A) [
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. T8 ?& a$ k& ?! W. F$ g. b if (r == vbCancel) # L+ v. e1 W8 P, {" y+ }
{
; w8 w& J; b% x( Q, F simple.CloseModel(); % p# ~6 P$ B3 Y4 D/ O$ @8 ~
WScript.Quit();
+ M. t0 |, O, p+ O @ }
* F& B1 C Q" Z1 k9 ~. ~. o' r} $ c- Z9 @( t) z" ~+ Q
, f' P' R0 M. I5 P
simple.StartSimulation(".Models.Frame.EventController");
! s, q: ]) ?" M
$ O1 p. s' a$ p$ q5 nif (simple.IsSimulationRunning())
( `+ t1 z8 Z" b R2 b0 X6 `! F WScript.Echo("Simulation is running!"); $ h, L& v; J- _. \
+ o" R) v- z+ D% O- Y! ]0 ~; J
// Wait until simulation is finished
, j- |/ q" {9 Z% [while (!Finished) WScript.Sleep(2000);
) Z9 }. v- ^8 I
2 j/ n/ X/ _8 B1 `2 ~simple.CloseModel();
+ h$ M& b1 R' R! j7 Ksimple.Quit();
( W, f/ w. d% D: D5 @, R" \+ _WScript.Quit(); 0 a1 m* Z" ^6 U' J% `
$ ]+ z% V4 k5 Q i% @2 U
/ S+ R7 _2 M' N4 a6 \9 c# d9 z6 Ifunction RemoteControl_SimulationFinished() , L% L: ^0 D; S! C C7 ~
{ ) d/ U: K. }- d. H+ ?: u7 D
WScript.Echo("Simulation Finished!"); |