Example of a JScript
0 R, M( _- E8 D- G+ P/ f Ovar vbOKCancel = 1; ' g! w# C! |9 \0 `: z
var vbCancel = 2; : g$ ]: Y9 a4 u( E ~( f }
var vbInformation = 64;
9 w4 G' V! Q8 h8 Y7 P0 b8 Kvar Finished=false;
+ P* T8 m; H6 ` $ Y8 R" `6 A9 @" w) F; n
var WSHShell = new ActiveXObject("WScript.Shell"); - B1 B m9 D) r
6 {7 A9 X" B" u0 J( r, Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 D! ~; u7 y( l Y9 i: [
5 h. T% G! o: L7 Q& j3 K9 S
simple.SetLicenseType("Runtime"); . O! C) P) a' |" [/ D
# G) }# l0 ~/ X, M
try , u) B5 o0 ?5 r9 p3 R1 w
{
- m, h% T N! G& m, l# _: K // Enter the path to a model file! , @% A3 ?1 F8 t8 T# U* c& g/ x
simple.LoadModel("C:\\Models\\Test.spp");
% ?; N; c+ L5 [) Y1 ~0 F, m; |} ' N; |. K! Q/ J# v1 i- H$ G
catch (e) 0 k" G+ N' p2 v9 [! |; U
{ 6 j. E6 ~' n: v- [! d; v4 h
WScript.Echo("Could not load Model!"); 4 m# q, J1 [7 B' Z6 F( _% U
WScript.Quit();
; g* J( ^9 E! X} ( I0 @' L; _" g. W! p% c% A
^( {% w( |8 T4 f# k+ V# x
try
v8 S1 o3 L2 h0 s4 ]) K' a* V8 E5 x{
9 v+ L# h& `5 f+ X7 P. P$ J7 V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ c# U9 C) P$ {- O; V r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / A9 _& z5 ?7 Y& J. G
if (r == vbCancel) 9 Z% H4 F% f; h$ `9 H
{ # [2 g5 C, j$ f, H) T6 L
simple.CloseModel(); % X6 I) f" T0 u. v
WScript.Quit();
# l2 i; K1 H/ B! E& P5 b4 g: Z9 N }
# F# j6 k k4 b& D" q3 t} T( U+ m! \% V7 b
: H) P1 U o/ z3 x, _, d: wsimple.StartSimulation(".Models.Frame.EventController");
. K. b# [, |0 B( Y
+ c9 F3 W& E& aif (simple.IsSimulationRunning()) / N. `! k8 X5 x3 X3 o
WScript.Echo("Simulation is running!");
) z% x' e$ S3 V0 C9 T 8 } u" y* ^( G6 A; p. `
// Wait until simulation is finished
6 W5 p( |- t4 z2 T' d; Cwhile (!Finished) WScript.Sleep(2000);
/ t* [+ Q/ M3 l4 m: }8 { * \1 _8 N; M* n+ b* [
simple.CloseModel(); * e* Q* {3 z, G @" z
simple.Quit(); 7 _" H- \( A- s" A) Y7 O0 X U
WScript.Quit();
2 M/ N7 z6 }1 B z1 n. n% R) R2 e- F% S
/ w. J$ [3 R: k% P! o+ j
1 c, o4 X# Z) `. g9 @8 Efunction RemoteControl_SimulationFinished()
9 f& e2 B" Q$ i) v+ S& H9 \{ - s" @% r; E' K% M/ `: Q( D0 y
WScript.Echo("Simulation Finished!"); |