Example of a JScript ' K- p7 C$ p: {' M! L
var vbOKCancel = 1;
1 Q. `% b( Z- E6 B F% D* jvar vbCancel = 2; ( y4 T: M% _7 [% F4 n5 E; j
var vbInformation = 64;
8 ^9 p3 A' V Jvar Finished=false; 8 _" U) K' x* o2 U1 S1 k
y. h, m: }3 s% Y& H8 X7 \
var WSHShell = new ActiveXObject("WScript.Shell"); * E# D+ E; L* H" Q# r8 I, S
0 v0 j* d3 w! R( S0 E) x' P+ q0 s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 @- g; w9 G4 c
n' R1 i$ G: j. j8 f1 n* |0 W0 Nsimple.SetLicenseType("Runtime"); & V/ a; h; ]; g9 j; S, f: }9 t
( R1 h e8 a( k
try
0 T1 h) m0 q! K8 O4 a9 l{
/ ^4 `) Y& r0 U: o A // Enter the path to a model file! + q1 R$ N% e) W) Q0 _! x
simple.LoadModel("C:\\Models\\Test.spp");
- ^% ]+ J1 X+ c. O" N: W6 Q} - m, [9 c, |) Y7 ?( W {2 ?( ]
catch (e) 8 @- E* W: w' ~6 z9 r& k
{
% O- x$ y/ H$ q0 n" N WScript.Echo("Could not load Model!"); $ ^# ?( D# O' o# {: r8 H7 I! R
WScript.Quit();
+ V/ }2 N; u$ m6 g% q2 Y; y} ' S2 F y5 v9 v [, c
# o, P; L+ {1 R6 V0 b, d% Otry " v1 O2 I; f( p* N- t& n( h% _% \0 ?8 E
{
& W* z/ m. c% C/ b9 @% K* j! G1 n simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % n* C `9 n- G1 j2 e B; [
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * j5 @$ z7 D% X
if (r == vbCancel)
( b2 b' E- P/ s. U W4 c {
1 `: R' U( c/ R; I6 [ simple.CloseModel(); 0 T* K1 ]* @/ r( z& b# g. G
WScript.Quit(); 6 o$ u% B9 j; l W6 N( m
} 7 P& X2 B& {2 h, S3 S5 E- D
}
. a" P. D/ F# _- x$ G8 j" z & E8 ^2 c/ j8 m% S+ |0 C
simple.StartSimulation(".Models.Frame.EventController"); 6 @, `0 p* e1 M- I! U
& e9 o. j) M; O0 L4 l7 B
if (simple.IsSimulationRunning())
1 d; d+ ?. f0 T0 ^ WScript.Echo("Simulation is running!"); - U X/ b& C/ Z8 C
8 O' y! E+ g9 c j& ~// Wait until simulation is finished ^ e( ~; t( C8 K4 G
while (!Finished) WScript.Sleep(2000); $ j( |5 h9 U# U4 K
) Y6 F; j$ T% n6 n+ fsimple.CloseModel(); 4 `3 L9 l' K( a, `& x# i
simple.Quit();
" D. s3 K+ i: v% b5 ]1 r9 UWScript.Quit(); ; \4 x2 {" d0 P& c# K9 h H! w+ X
+ O+ F# O* B1 j. r
- Y! a% f8 }2 T4 Yfunction RemoteControl_SimulationFinished()
' K3 a1 P# m' g{
- V7 w6 T; v/ [. B WScript.Echo("Simulation Finished!"); |