Example of a JScript . l3 N6 n, V0 T
var vbOKCancel = 1;
2 H4 f; Q8 Q4 k- \: m/ Y: `9 Tvar vbCancel = 2; 5 S: B g% s- Q* e. h
var vbInformation = 64; ! [8 s Y) I; ?0 i) [
var Finished=false; n: z0 f) P2 w5 v: `2 v
7 W; A. N( X% n8 h4 D
var WSHShell = new ActiveXObject("WScript.Shell"); " W. H% V& A4 D1 m
! e6 l4 L& s- z) b- h. t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 T% ]$ p# M6 u5 v3 K8 R3 d0 A
2 l1 ?3 m2 _5 U% |+ a# U/ r1 N0 Q9 m
simple.SetLicenseType("Runtime"); + M8 |" }, t1 a1 P2 L
. r5 x$ ^* E7 O! T p( U( L
try ; X, p$ ?! |2 F
{
) S8 k! x4 y1 e2 c( P8 ~ // Enter the path to a model file! 9 a9 N; Z H3 S9 Z
simple.LoadModel("C:\\Models\\Test.spp");
8 ^3 v3 y) g8 X$ O0 ~+ P}
# x4 D) B3 T; \: x" r, Acatch (e)
( n7 {& }) v; r$ N- Z+ E{ / R0 @' ~" G' C1 b! V3 ~
WScript.Echo("Could not load Model!");
* q' R4 ^" v% k WScript.Quit();
7 I7 t0 _7 ^% d- Y! @2 A} ' B9 K- c% _ ]& Y
7 B% H6 _& Z' X
try # B) @6 x5 d W" a
{ " c2 Q+ |% s* g# Y" x+ A a0 |
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , S+ ?" P9 F& q4 J) P" n
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 P" O6 i1 Q. p( C" U- D/ v
if (r == vbCancel) * I2 x; T) f# T: M2 L+ }
{ ( |; U, D+ x, z. v5 L+ K$ {$ u
simple.CloseModel(); 0 N$ j& l8 X1 n: L% Q0 A
WScript.Quit(); 9 r# R$ p/ A" Y7 _* ]
}
& _6 G; Q6 i6 j. e} ! m$ g/ N G: \5 c1 O* m2 [
4 E# K* ?/ w i
simple.StartSimulation(".Models.Frame.EventController");
0 l ]9 b' W) B - T' z! j$ o# f8 V
if (simple.IsSimulationRunning()) : W" s4 P# q% N7 {
WScript.Echo("Simulation is running!");
+ p" `) I" i# I* l3 l ( e0 }+ {* E: e l3 t5 }, A
// Wait until simulation is finished
- k% ]' g, l3 M0 O! _9 s: d& gwhile (!Finished) WScript.Sleep(2000); 4 [! G$ F- `2 ^ K' H: t; `
4 P+ M1 D8 X* k9 b; [
simple.CloseModel(); " M; M/ H) h+ M( f
simple.Quit();
& i7 B' K% v8 F) jWScript.Quit();
* M, D, n: M6 Q( t0 y % F' w; L" p5 y" ?) X
( s3 _! h' g {% Y9 T5 y. O+ jfunction RemoteControl_SimulationFinished() , L& C" Z% n E Z9 Z) I
{ * u) ^5 G9 U8 R3 N6 C
WScript.Echo("Simulation Finished!"); |