Example of a JScript
' D) v. r5 t- u+ mvar vbOKCancel = 1;
: i0 k/ V9 k* ]; w0 s3 Ivar vbCancel = 2; * F2 k5 s2 {5 `. s0 w; D
var vbInformation = 64;
" H/ @" }$ |# v. s2 ivar Finished=false;
& @ T1 J5 @. t* D% T " Y+ q; R. P4 h
var WSHShell = new ActiveXObject("WScript.Shell");
4 F% T% e1 W* G$ ~+ \! \$ a
3 F5 U% \, ]6 V) a' Wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 c9 P4 t! U/ }. n8 [' g ) m+ r8 x) q2 S' f4 U' u# V
simple.SetLicenseType("Runtime");
6 n2 U" p# v# `; g
% g: x# z. Z9 `( d2 H5 l. Z Ytry : ^6 f( G; }* Z; h7 L% r
{ ( X8 d1 ~+ M2 n" B3 @
// Enter the path to a model file!
! Q- b ~5 a3 L4 u3 p3 t, E simple.LoadModel("C:\\Models\\Test.spp"); , n/ M5 c# w7 O2 J- Z/ c5 U7 A- l
} 4 v. ?* ^2 o# @. B/ u: u2 S
catch (e) 2 @1 }0 m b& ?
{ 3 G+ e' Q9 ]: Y. q* o
WScript.Echo("Could not load Model!");
( d; T: E9 y9 ?+ e WScript.Quit(); 7 j7 A* G! K7 W2 S" P) C" ~/ t6 o
}
2 o6 Q% @# W" b* \
% t8 q" a# s! T& e5 K2 I' Y, y, Vtry
; R( @; z3 L3 z9 j{ $ _1 u3 J6 K- q! g9 M9 N! U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- u. M9 `% D, p) f; C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
q: i0 ]& w& ?, l4 T if (r == vbCancel) + a% M) G! R. j- X: u
{ % Q6 B, {: S' y4 f' c/ {- n
simple.CloseModel(); , e& Q" y2 e3 I$ o9 W% ]* ]
WScript.Quit();
; Y. H+ ~, Z" b. W* \ e) o2 [4 Y I }
: `& m! e# ^9 M8 G) s} ' a7 @: n* e9 H9 s1 _" l
* V8 d( v% g+ \5 _simple.StartSimulation(".Models.Frame.EventController");
8 b; T y0 Q, ^* a* j8 j5 M1 `1 q
5 @0 D. [* h" |if (simple.IsSimulationRunning()) q, p5 k- R( R9 ]
WScript.Echo("Simulation is running!");
5 w1 j% `% L9 a* d- j
, \3 l) u+ X, H5 ]0 W) U; g# H// Wait until simulation is finished
3 m! b( ?! e8 `! x V/ Dwhile (!Finished) WScript.Sleep(2000); 6 F7 o. J" G4 f+ Y, i( o n& l
8 I& y, i: w3 m4 W9 Dsimple.CloseModel();
5 r: q" s2 T2 psimple.Quit();
! t% k; W( s. {9 U; @' {WScript.Quit(); ! b! e: A# L( n$ l
. F6 A: H( B: b& p- h" i
, j& K) s# h6 H0 efunction RemoteControl_SimulationFinished() 2 ^6 q; _0 E$ @. z$ c; D1 ~9 D
{ & M7 A! Z2 j& @/ [3 H5 C
WScript.Echo("Simulation Finished!"); |