Example of a JScript
! W6 J/ g e( [: Evar vbOKCancel = 1;
/ o$ |1 |. F1 |/ Y" E5 Nvar vbCancel = 2; u# R- i# A0 ]( \- `
var vbInformation = 64;
" T! ^8 S$ a' P. Tvar Finished=false;
( i" m% y% L8 T7 E- M$ X8 P! H% L
& C0 \8 T# `( S! Z* b Zvar WSHShell = new ActiveXObject("WScript.Shell");
0 ~; O* A3 D( u# z8 D3 P8 y. ] . [- t0 Q: x: V/ j, L0 U
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 P* @) n9 w3 H* {
! {# [" z$ j+ H3 w" osimple.SetLicenseType("Runtime");
6 F+ l( V E$ Y; q3 H) o , V+ J$ B. C8 g. A' t, {; `
try
( n H; m" v1 {; t6 c{ 0 _# i" w/ _2 D' X6 y
// Enter the path to a model file! 8 X- b* e, c) J4 T4 C1 ^
simple.LoadModel("C:\\Models\\Test.spp");
6 Z2 b* e7 w. ^- Y9 R} 8 F& u3 _8 [, [( \
catch (e)
& k( z' L) }* q2 n8 l: R{
$ u0 ?+ B+ H. o/ z: @ WScript.Echo("Could not load Model!");
8 P. m7 T9 y. ^& k7 a6 ^/ {9 D WScript.Quit();
4 N9 [* \: Z: ~& x1 t}
8 C+ a, {+ y* ?1 M& m8 C
$ C' u2 Y# Q$ B# F( r* h# }4 Q& e. ptry
0 N7 k2 R4 h& p& g9 n. H{
* i5 a7 x& ]: n: S- [ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 C* M$ @. Y( `3 e+ C9 ]- ?1 L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : L+ X4 A9 F1 m6 F2 b
if (r == vbCancel)
' t$ Y p% p! t8 v {
$ z6 ?" W/ z) _: u6 w% G4 v2 J simple.CloseModel(); " V3 _7 B5 @- b. u) e
WScript.Quit(); & D/ Y" ^6 E7 n1 F+ w
} + n0 a& r* y3 b& t w8 `
} & H7 d: U) w/ u: b
& U$ q% _1 [' @( n) [5 _5 \
simple.StartSimulation(".Models.Frame.EventController"); 8 u: s) o) y# g$ s
; x1 Q6 D- w) N% ~$ fif (simple.IsSimulationRunning()) * ~/ i N3 T- Y( C6 J
WScript.Echo("Simulation is running!"); 3 _6 a, Y8 C2 }& k' Q- O: v
e0 y( b0 p1 C3 V* C- F5 ?
// Wait until simulation is finished * a+ o$ V9 f, D# o6 G2 b
while (!Finished) WScript.Sleep(2000); # O0 K5 E& ]$ a% Z& I0 O
( R; J, |/ F1 S
simple.CloseModel(); 6 R# z2 D Q- `9 [
simple.Quit(); . @* E2 o1 f4 j# b% M! N2 e
WScript.Quit();
6 x+ i, A9 p+ ?" B7 U5 Z/ I! C g& P
2 w0 c2 H# ]$ O( R& l* q- d9 N0 g9 r
) X7 w: F/ H( ]+ U7 l$ j( h: |* Ufunction RemoteControl_SimulationFinished()
- V' P& L) q' W* m9 f7 o" x9 L{
1 z6 W% V% g& x# L$ _ WScript.Echo("Simulation Finished!"); |