Example of a JScript - P: |6 Q) }, C# w3 i
var vbOKCancel = 1;
6 i5 {: l2 n0 i: V6 Jvar vbCancel = 2; 5 P, U$ g% L( e4 s: J; U- k1 ~8 k
var vbInformation = 64; 5 l- S6 x) H! l+ |& A9 Q* N
var Finished=false; 5 ~& o4 C' B9 S4 f+ L
! d) B3 G5 a- o' c: w
var WSHShell = new ActiveXObject("WScript.Shell");
! }( h5 `3 k# T$ g, g+ W" N ! d `. O7 G. e% L' _9 t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ {: \% F$ o: V$ t7 o' z
0 l) P3 Q5 N9 `simple.SetLicenseType("Runtime");
8 T# x9 V K# z9 b2 a " p- E; o4 B* R
try
: |, ], @' V. r{
3 L- t- C5 p5 i/ r' |2 E // Enter the path to a model file!
' k8 G3 @5 s; O) g% Z& s, a2 z. K simple.LoadModel("C:\\Models\\Test.spp"); 5 s) J- N) {$ l; ^' }% f9 V
}
- n0 I7 R8 S/ g x% [catch (e)
- I: g& j4 {# w$ _{ ' K! @1 P @$ H
WScript.Echo("Could not load Model!"); 8 n% h# G4 K5 n! j" R( }7 H
WScript.Quit(); + O( u9 g: U% G! V
} ; g7 m, _' J- W& f
1 Z0 w6 M2 f7 utry ' `3 X3 ~- w& `0 y& j2 T
{
& `0 l, }! [' W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% ^1 s3 s0 g3 i" M6 i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 ]% K2 B6 e! q" k- k if (r == vbCancel) # h# v! J. ?& l- u. H
{ ' u8 c/ q2 K8 D& u7 |) D/ T
simple.CloseModel(); a4 H4 M: k I" |( n7 f
WScript.Quit();
_7 f" P4 k' m: x% C } % u7 b% k, T9 ]* X% ? N
} 7 M; h7 ]' V9 A/ e) l
5 g; S+ J- t. L* u$ k* m
simple.StartSimulation(".Models.Frame.EventController"); * E, e1 y- L; P' k( R E& e
2 M3 H5 v d1 a$ O) l# [
if (simple.IsSimulationRunning()) 0 Z8 f- v }* O6 u- n; e0 @) h1 s% D6 v- K
WScript.Echo("Simulation is running!"); $ k. @6 h8 ~) z+ R0 ?6 Q
/ E$ Z5 X' |4 i. F/ a, I
// Wait until simulation is finished
# f' Y! c- Y2 Y4 rwhile (!Finished) WScript.Sleep(2000);
2 g; m& \+ V! v( M; P0 ] 6 D- j5 v2 L' R+ P; e
simple.CloseModel();
* ?8 R; h* V, ]* W$ ^$ Xsimple.Quit();
' p* T% e0 `) {; V4 I* T VWScript.Quit(); 6 f9 p) Y' i. @! h
, ^6 N) W4 T% \! b) @& a2 Y ' S- x# K) l# t4 |* S$ m- r8 h4 Z
function RemoteControl_SimulationFinished()
! Z$ h% G! O0 L: }$ K1 C0 ]{ $ u# Z! e7 r5 t( r. S
WScript.Echo("Simulation Finished!"); |