Example of a JScript
' r8 U/ ^) v& Q& R! Gvar vbOKCancel = 1; ) v2 A w, W6 q, B7 w
var vbCancel = 2;
7 ?. ^4 [" g6 x- c0 p \9 ?var vbInformation = 64;
6 K& s6 w u% A; X: g% c; hvar Finished=false; : ~# K' ?4 V- y$ W; F
8 s. L$ C" C$ @! L0 N
var WSHShell = new ActiveXObject("WScript.Shell"); * P. S( c2 C7 d6 J& ?* o, ]9 B
! W- h+ }5 z1 O6 }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ D- j8 ]( g" {- r' O) z2 y6 S ; w; P) d7 [0 N( C3 K9 T
simple.SetLicenseType("Runtime");
9 z x/ Y, U8 f2 i4 b* k
) o7 E. ?/ h1 t% E0 ^try 3 O! \2 V4 R \5 H# c% R
{ 0 K+ C2 o' m( Q1 B- @& ?2 [
// Enter the path to a model file!
8 f! t0 h$ s& j2 \ simple.LoadModel("C:\\Models\\Test.spp"); 4 T0 t3 |7 o+ ~
} * p; a$ H. A4 e/ @( m2 |; Y z( Q
catch (e) 9 L0 D) B( ~; [5 u& t* h% f
{ . p( j& k0 O D, i5 l6 B' [
WScript.Echo("Could not load Model!"); M" v+ B8 e, W3 }+ [
WScript.Quit(); ( y; C! @6 B5 l$ x+ p8 a
}
% Q- I) W" T2 r
, @3 L' N7 a, V! s& D4 K6 etry
$ n2 N% B1 V3 Q{ * a2 |1 D% x- |1 d" G" K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : U/ t1 ?1 D# ]9 q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & P" T% E; P, T* z9 a/ m1 d& T* Q
if (r == vbCancel) $ s2 Z( R: Q: W
{
1 P/ D: F8 d9 x; E/ t6 j$ F4 E7 H- P& y simple.CloseModel(); 2 R+ j# Q: z# S( Z* z2 x
WScript.Quit();
: f3 e# T" A9 B0 k; d' R1 J) N }
% Z- Y w [; ?; ^} ) l% c( ~: z' x/ q" u
5 r/ v! k% \6 H0 N+ i
simple.StartSimulation(".Models.Frame.EventController");
$ ~7 b! d: X* v2 c& F; q5 {
$ p& ?( O, g& z+ ~if (simple.IsSimulationRunning())
1 Y! l5 _+ h9 a, L3 m1 {( l# S WScript.Echo("Simulation is running!"); ; t1 G8 @5 r4 o' y9 U
+ e K6 L" h3 I// Wait until simulation is finished
+ ]0 o) z" s9 j; D+ K( Uwhile (!Finished) WScript.Sleep(2000);
. E0 {1 ^/ v* z2 [$ n 3 [& R3 Y0 b9 [
simple.CloseModel(); . |% I. n3 L* x0 ~
simple.Quit();
$ E$ @ b0 e- ?4 sWScript.Quit();
# }1 O+ l" D0 K) v6 G
* O7 N$ `& b( c7 d* g1 {! J" W- t
P, X& R( w, v0 q9 ~7 cfunction RemoteControl_SimulationFinished()
. l. _& K1 h8 N{ 7 U- [ Q) j) v, `- Y, a
WScript.Echo("Simulation Finished!"); |