Example of a JScript
" y: a& f8 ? r: [4 P& x( |var vbOKCancel = 1; % M: ]5 D6 b) m! K6 m& \( W; d
var vbCancel = 2; 6 S0 | T8 q' I2 c8 \
var vbInformation = 64;
1 E; r- K# r; u) X" h. t' ]: pvar Finished=false;
9 `% m. \/ t/ p2 U% |5 @% T : h( X6 u1 A s6 H
var WSHShell = new ActiveXObject("WScript.Shell");
- N K3 O$ ]4 G+ L% ] , F* f9 H: q$ ^+ q( L! E
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! {( x' O( F9 V6 C E; D$ e ! d% U" P7 j* S
simple.SetLicenseType("Runtime"); 8 b2 X3 K% M. H
$ R5 D1 T2 k/ ~; U. q, T
try
( t t& a, H# F{
3 n1 |' e* D3 l' ?. ^$ \8 [ // Enter the path to a model file!
: W1 m( A% W9 w% `: G simple.LoadModel("C:\\Models\\Test.spp"); & G) r% E9 r9 v. r# Z+ ^& @
}
S' u2 X' I! kcatch (e)
% k! }) A/ B5 r+ b) S" z{ : t3 p' }( w" W3 F/ Z( v
WScript.Echo("Could not load Model!"); / O6 L' N, U9 V
WScript.Quit(); " l3 f M A2 }
} $ j- Z% n# f* ` ? v o" Z! Q
2 {. u6 H; {3 C- Ztry
4 _" v% J$ Y& F" R4 x9 ~{ ' k2 [" K+ V( W6 P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: n+ L5 [3 i0 A+ b8 ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 5 {* z& w$ _5 Z: m3 i5 T
if (r == vbCancel) 3 o0 A! r- h# W/ y' }' b# I, `+ [
{
c. B# b7 I" Z( I; U3 V simple.CloseModel(); I I8 Y' d, Z# @/ f* ^0 |
WScript.Quit(); # E5 `( _( Y( U5 u
} 7 P+ [4 i1 r. L
}
& K x( F7 v* R; R 2 W# K2 D; L+ h: h
simple.StartSimulation(".Models.Frame.EventController");
- q7 b$ y+ f6 J5 z2 n) s & ~% l8 H" C7 v2 {9 O5 q9 a
if (simple.IsSimulationRunning()) 4 Q% e( K7 Y# \
WScript.Echo("Simulation is running!");
5 B; U, e" ~+ M* @+ ]! m ' V! w; T j2 ]
// Wait until simulation is finished
& l w$ s% }* s# R# s$ S- V: o, \while (!Finished) WScript.Sleep(2000);
0 f5 X8 a& j) v" y2 X , o1 {1 B" G' A0 o( Q" h
simple.CloseModel(); : U6 v% b! h6 f6 F' `6 G; s* S" r
simple.Quit(); 4 Q& Y$ J7 a c8 S# S$ ~: n8 |( P
WScript.Quit(); ( k3 B8 r& R" x* O. s; n
2 w! w( l- e* m( j% e- t 5 d% h- _$ S6 \- n5 y* _
function RemoteControl_SimulationFinished() p; u* u6 U/ ^7 g8 X
{
) [) Y* j; n& O) J WScript.Echo("Simulation Finished!"); |