Example of a JScript . O% I. f. {( T( L0 Y
var vbOKCancel = 1; " G* m- x D j' G4 O
var vbCancel = 2; * a$ i! n. C# e% |% s
var vbInformation = 64;
& ]6 y! b9 y9 X, pvar Finished=false;
3 X$ K, X9 m; M% m& X, y
2 h& f8 z& a. w R v4 a* vvar WSHShell = new ActiveXObject("WScript.Shell");
& y0 o) r. G' g& K! Q. I" J% l ! @2 d: ~2 W; t4 L8 L& r' h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & ?8 H5 Y& ~4 Q% z, N. {
2 D% `6 q' a; _( dsimple.SetLicenseType("Runtime");
: X, k8 P: h' v" P. `6 @$ z 1 B6 l3 Z/ V/ E) t _/ V2 H
try 0 E8 R) u. Y6 b7 @7 b E+ Y
{
1 c L q$ u ~; G // Enter the path to a model file!
) O7 _. X! s, I I3 B9 o9 P simple.LoadModel("C:\\Models\\Test.spp");
! D: Y" B( w$ r: d5 H} % c" H; G4 Y; J
catch (e) 7 K- z( t3 @2 a# j/ ^3 ?1 b
{
8 A) l" j/ i' y, D8 \$ I# @ WScript.Echo("Could not load Model!"); , F" O+ ^( }! P4 W3 W
WScript.Quit();
5 t+ F5 s+ t. s: @} % F& w5 s5 V! h1 p% q% B
2 d& Q4 w7 T4 q& f6 e+ o8 r
try : k: ]+ M" F8 T- F+ o! }* t
{
' i: w+ [% i& S/ I1 P. U x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( ]( i4 F |' ]( Y: Q2 W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ B- o9 W" _! L6 R: p if (r == vbCancel) 8 {7 t6 f5 w" F$ {8 k& ^1 V' W
{
' D0 V/ ]. c' _+ i; ] simple.CloseModel();
1 H# {* z1 k% W5 q# ` WScript.Quit();
8 w5 i( O( _" M8 P9 e }
# r7 Z2 P. g! B: V3 P6 f% {# ?}
+ l% [( G6 z( p/ ^$ F, ^ # |4 i; W3 g$ y- c- W; K8 {5 b
simple.StartSimulation(".Models.Frame.EventController");
5 z5 b% j% Z: h
|2 Z1 x; E( {( C" B Gif (simple.IsSimulationRunning()) , S/ k- O, E( @: w
WScript.Echo("Simulation is running!"); 4 C& p- m( l% L e: {. ~' z8 m
) y. f& Q' }' z$ `// Wait until simulation is finished 0 J( l1 q$ x, v; V( X! r6 G% I/ z. F, c
while (!Finished) WScript.Sleep(2000);
0 u9 ?6 `4 G: v , @% D, o; P( A+ F' h5 G
simple.CloseModel(); 0 G/ y2 B. j3 a* X+ A% ` ?3 o
simple.Quit();
. d( g% k4 H: q/ bWScript.Quit();
4 h- q, Y; ?! W8 J* A3 h" f' M 4 {* _$ \; m! B$ u
; r @! H, G9 \4 a8 Ifunction RemoteControl_SimulationFinished() 4 S f) z ^8 x! R' n5 v# f
{ 9 A7 S% W* b* r# b6 \6 l
WScript.Echo("Simulation Finished!"); |