Example of a JScript 3 t G; k# I+ J5 d5 h
var vbOKCancel = 1; ( z8 V: c9 i: P
var vbCancel = 2;
1 D! B# E2 A! t; m- I; kvar vbInformation = 64;
7 V5 B. F. i3 B2 n$ |var Finished=false;
8 J3 D- y! ~3 [, l% s
) F! T+ I" X, G5 {var WSHShell = new ActiveXObject("WScript.Shell");
* y# s1 s7 x9 w' O, J , q' b1 C5 R7 `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 Y, p1 [ V+ w9 Y: ^% P
) N4 [( e$ d6 c! g: Tsimple.SetLicenseType("Runtime");
# b* A7 k* t5 v " D+ b8 E* V6 [0 T' ^: U) W
try 4 C6 D4 d+ a# ]6 f. s: X* Q, |
{ 6 \% |7 Q% z( l2 Q0 ]" Z
// Enter the path to a model file! ; h3 u; J+ u& {
simple.LoadModel("C:\\Models\\Test.spp");
, }! g( F2 D6 x1 ~; W}
! e) H- Y5 \+ X% W+ `catch (e) 7 ?* p) c8 `/ B# O5 D! H9 r6 k
{ 9 R2 O- ~2 \/ K9 F
WScript.Echo("Could not load Model!"); 7 o$ W P- @+ ^ Q
WScript.Quit();
% `% B) ?/ p$ g$ X5 k} & Y# {' w& `1 U& N
9 Q% W8 F+ @5 D) vtry * s- V5 |* J0 Z; `
{ % m8 m7 n; H/ l9 U ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / W {& w3 K R& S/ ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 s9 ~ r% g! z3 G/ ]" ?9 Z+ _7 @ if (r == vbCancel) e! i# P% d9 ^- n
{ * m) g8 _" Q) n9 d; D9 F! T
simple.CloseModel();
; i/ i! X: u8 { WScript.Quit();
5 k- z1 P% b7 S5 s } 9 F5 r) M# ?( `$ z2 e
}
& O; ~% W* ~9 t $ z/ Z; S7 I: Q0 s! ^. x
simple.StartSimulation(".Models.Frame.EventController");
?' d/ v1 L) ` U 3 J4 V7 k5 c* X X7 G# p
if (simple.IsSimulationRunning()) 5 r1 W* q% K; R, c
WScript.Echo("Simulation is running!"); 3 R7 l: F! g+ V6 s
( S, G! Z8 H5 \+ p" _
// Wait until simulation is finished
# K5 x; x4 E5 F9 |6 ewhile (!Finished) WScript.Sleep(2000); 9 Q/ I3 ?; k9 o& F, z: q# ?0 Y
- @$ c7 v: f) o) osimple.CloseModel(); - K7 W! O7 y# _2 T* v6 b6 }( Y0 w
simple.Quit();
% E) d0 j( h% K7 k; z8 e* }* b. V( sWScript.Quit();
# x; e& K8 b M9 v. S % R* L6 ]: v: l4 q- `/ p
2 S9 T% X$ ]- g3 dfunction RemoteControl_SimulationFinished() ! l2 Z2 O- J+ ?2 y' j
{
6 E7 h8 U% o5 f2 ? WScript.Echo("Simulation Finished!"); |