Example of a JScript ' ~. ~: l( }0 {% |/ O- v) U" I
var vbOKCancel = 1; ' Y4 B2 E3 V4 b" a v% U. U
var vbCancel = 2; , `* t% [1 \8 _# r( e% E/ O
var vbInformation = 64;
& |- z+ x D6 \3 k9 H5 M+ W' cvar Finished=false;
3 m3 F, O9 V% m% `# U3 ~3 _
! K# v0 ?8 w; X- `. F) [4 e! Pvar WSHShell = new ActiveXObject("WScript.Shell"); $ K8 L! n! a; p( D6 |6 _
4 c! I: W* O* {! |: }. ]( o0 ?0 evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- ]/ \6 d/ _- }; s1 b( O( S! l( j 3 D; C4 v, {! w4 x! G
simple.SetLicenseType("Runtime");
( a7 r4 C, U8 l8 C , {1 I# u4 Y2 Y& n% g% D& T' ?% v
try O; b1 @* y. W' G
{ ' I% u% M( k& I: ?: u5 V& p2 J
// Enter the path to a model file!
, K: n9 U1 H. C( v simple.LoadModel("C:\\Models\\Test.spp"); , e/ S; _7 z* X+ ^
} ! A$ f2 @( F+ X5 S
catch (e) ) n4 B& I1 [' U5 y1 u+ j1 E
{
w$ X. }6 U2 Z1 H& I, Q WScript.Echo("Could not load Model!");
# @* j' g# F3 {- B WScript.Quit(); # P/ v' J9 ]2 _
}
4 ~4 a5 w- X- Y( { 6 e: ?* ?4 L; v' x! c9 n# _6 W
try
) l& D4 g9 ~2 H0 X) e `{
0 ~( P) Z1 q0 `8 f8 B& V5 `# u7 R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( }+ j& y V* `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 _4 q) H# O3 ]$ v+ L' L% C
if (r == vbCancel) ) L* y: R% H7 M) ^
{ 7 n) B& p3 F* C. w
simple.CloseModel(); % r5 m( _: C' S% D# q/ H- k$ K
WScript.Quit();
! Z: @6 X* C* P5 ^2 I- _7 \ }
. @4 h, W+ f* r. K, Q} . h0 X. a. ^3 `' R3 z
( E2 |/ x4 m0 d" ]
simple.StartSimulation(".Models.Frame.EventController");
: i% Q" R; p3 u0 f% _
/ G- D! e) C/ }3 S" |- W8 f1 {if (simple.IsSimulationRunning()) ) c& X% Y9 {0 Z* Y
WScript.Echo("Simulation is running!");
. P+ N. \2 l, }, z2 |" q; J$ z ! r" t- G, \( W0 E1 y
// Wait until simulation is finished
8 D' k. G3 i4 a# A7 {$ ?/ ]while (!Finished) WScript.Sleep(2000); # P7 b& h5 Y8 W
; J! [# B8 a' h I5 S3 A
simple.CloseModel(); % s1 }/ |5 V4 Y7 q
simple.Quit();
" z: Q8 F# w- K$ G/ I6 p! `) o( ]1 \WScript.Quit(); - F1 z% C( L. p% f p
- M0 Z I3 _, x" ^: M4 G
* `9 H% [, b8 T: ?$ U# `. E* l0 d
function RemoteControl_SimulationFinished() % [+ a6 A& v: ^6 Z2 E1 t+ @8 `
{ $ Y P; e" |& |
WScript.Echo("Simulation Finished!"); |