Example of a JScript " W$ L3 o' A& n0 R5 F
var vbOKCancel = 1;
6 x) [7 K: T- U( _: x! uvar vbCancel = 2;
6 y; @% K7 m; X! w# S3 ^" z5 fvar vbInformation = 64;
g5 x$ {4 c V; |! Qvar Finished=false;
3 ]3 \, f: p4 \8 }9 n7 H: D* _9 ? , D ?8 j( L3 \3 n# c, i3 E
var WSHShell = new ActiveXObject("WScript.Shell"); 9 ~5 s# r2 s1 j* J
; Q/ `. B9 ^$ e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 o/ I, p- k. I* G9 |& t( t! j, T
4 q3 l! l8 M9 m1 a
simple.SetLicenseType("Runtime"); - A7 L1 Q+ z2 f, E3 i0 s
5 T+ u4 ?# f4 `$ t. k0 Itry
7 K* A; n6 D- j# F3 |- {& [8 Q3 {. o{
. V; [3 H; t( X! k // Enter the path to a model file! 8 `' V; m$ b% n* ~
simple.LoadModel("C:\\Models\\Test.spp"); 0 p- }3 Z! z2 K+ R- v7 a! T4 K
}
6 l* L' `: Z( X' ?catch (e)
1 M8 W2 J$ O% V{ $ j- @/ `2 Y* r+ n9 _# ~
WScript.Echo("Could not load Model!"); 9 U$ ^- Z7 T ]/ f5 i
WScript.Quit(); & t: {* v0 U, C x: W9 K3 r9 l! i* v
} . }) d6 M7 P" q
' h8 S$ q! `) I9 p3 A6 ?9 f A
try 2 E& p& k, {5 G5 c
{
7 W* R% Z4 k) [" Y, p7 O simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 S, i* z p) ^) f7 ?$ Y& n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 c- q# b7 n7 @7 N1 P" q! |9 q
if (r == vbCancel)
; g9 M! A3 y4 @4 N' C {
; R T7 J E w7 J! Q a+ _ simple.CloseModel();
6 V& F7 u) ]) P- N. w" M& G WScript.Quit(); . _& F5 f c8 Y; ?. ~, C
} 5 K" E" w/ }* s3 D
}
8 e2 p+ o( D% s; \5 r
- w) o7 a: J9 h y; Qsimple.StartSimulation(".Models.Frame.EventController"); 7 z3 h7 p6 L! e: S3 [
2 h- u2 a( `; E. q E6 y' y
if (simple.IsSimulationRunning()) ! S: Q P$ l: r/ k/ _
WScript.Echo("Simulation is running!"); 5 c" R+ e9 @" ^" g
2 p% a2 z# s! i9 N6 ~% e1 Y5 |" j) T// Wait until simulation is finished
8 O) b$ g1 ~5 \3 }# x( B+ [while (!Finished) WScript.Sleep(2000); + h/ H* E; C# U
- E4 V! _9 V) D Fsimple.CloseModel();
1 v; Y- K" g7 ]9 _1 F3 R; g. wsimple.Quit(); ' e; k, N% R3 ^9 W/ K3 L
WScript.Quit();
6 V7 v$ |, e j2 V2 O% f: q% S 4 a" W8 G% R2 Q9 m$ I% b
7 o/ ]& d. `* jfunction RemoteControl_SimulationFinished() + W* s- F$ X; k2 s% N4 B
{ 5 I9 m& m! `2 Q1 J1 O
WScript.Echo("Simulation Finished!"); |