Example of a JScript
" p3 w/ A. O8 }, z0 r* M1 {8 pvar vbOKCancel = 1; 6 }5 N2 b4 G* O" P) W
var vbCancel = 2;
: q7 }& ~" E* U+ L. h wvar vbInformation = 64;
6 t+ A- T1 M5 _* Svar Finished=false;
+ U! p! r! f) X& R$ N# i
0 e2 Y) V8 Q4 g5 O, Z/ I) s' r! Gvar WSHShell = new ActiveXObject("WScript.Shell"); 0 }6 u6 c: U! E
' L, w9 Z! \& i2 v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 _2 g O( x t4 A$ x 3 ] M# I8 T2 m/ i! d/ {& l
simple.SetLicenseType("Runtime"); 2 O6 F |, P# d: b, H) T/ t7 c
3 P* K* I: U5 x. ~# U% v9 |
try ; E7 `( C- N# b6 U- y( u# j
{
6 E# f' ^* D8 L' S // Enter the path to a model file!
2 {# \1 Y+ w& P: m# F5 K/ C simple.LoadModel("C:\\Models\\Test.spp"); , W* y6 T. V9 s% h5 t* L; P% c
}
6 s3 O) |0 h- acatch (e)
( b( y6 A" n- \3 o7 l' h{ 9 j9 k' z7 o6 a" h# f
WScript.Echo("Could not load Model!"); 9 _' \6 e6 M% L( V4 A
WScript.Quit(); 5 e. p/ W$ {% H" N( |+ v
} / ~! _7 ?5 m2 o! J' d3 J
# ^% e% R8 H8 s Xtry
q# ]3 }0 q9 z+ t/ M" N{ d4 B; a' {9 L; X m: K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ _1 A9 j; K) ~; B( v6 G& ^- S& U r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) ?1 ]4 [1 G* w+ j; [6 f
if (r == vbCancel) % G, j+ ^& ?: C, x( E
{
# K" U9 [; O1 Q simple.CloseModel(); ) K, B8 |/ B. a3 @
WScript.Quit();
3 B3 E" d5 Z2 y# j% n2 f } 6 h: w# l9 c, n @
} / B9 r0 Q5 n9 |( n2 ]! p
& W3 V* x$ \# G0 `simple.StartSimulation(".Models.Frame.EventController");
* U( E* f9 |! T# F5 A. t% o " d: t" }1 ^! z/ c" P1 g* I, k _
if (simple.IsSimulationRunning())
: V7 S; o7 k g- t# f WScript.Echo("Simulation is running!"); , Q/ Y/ H1 ~; l- y' R, j3 M$ D
' ]2 N- z8 o" M5 `9 y0 R3 \& g/ |
// Wait until simulation is finished
3 H0 h/ Z$ b; ~" u2 wwhile (!Finished) WScript.Sleep(2000); ' q2 G1 W; f- H) _
- u* K0 \1 {1 q5 ~+ `$ Osimple.CloseModel(); 6 @& {% S6 ~6 Y6 j
simple.Quit();
" h* a9 [* v3 C* B) OWScript.Quit(); 6 `7 X0 B. @2 P6 _1 J g
7 |) L+ c3 c8 c( F& ^
! V- T" a# R5 V3 q q; ?, l5 d
function RemoteControl_SimulationFinished()
7 t4 k, E0 h9 A8 C1 ]3 {' {{ + G5 d% w& Z k u" f2 O0 N
WScript.Echo("Simulation Finished!"); |