Example of a JScript 1 K9 C* G& c$ \2 W
var vbOKCancel = 1;
$ K+ C8 i) j. z3 hvar vbCancel = 2; . g# Y& S2 y. v5 _) I/ N
var vbInformation = 64;
5 P+ B+ M' y8 t. K( w( a* H, r# ?% t" xvar Finished=false;
' K' ]# i- F& t' c: y+ ]2 A; { " D+ }* G% e2 F# G* R5 f$ t7 Q
var WSHShell = new ActiveXObject("WScript.Shell"); 1 Y: a+ T5 _# g( m' X$ G! [
0 Q( |$ ^% u/ q7 o8 n3 H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" z1 _& t F: a" a " w3 w- s6 H$ Y' J4 m* _
simple.SetLicenseType("Runtime");
- m9 M, m: W! z. o ]8 _ 8 w! G( V) }- D* i, ~4 q
try / } D( r# r" S# c
{ 4 B& E8 N8 R$ ^
// Enter the path to a model file! - l) L C( _; N2 G+ U
simple.LoadModel("C:\\Models\\Test.spp");
) k+ e/ T: Q8 S) D' t/ U0 f} 5 X4 v+ |' L9 x( @/ {# u1 ^: C+ O
catch (e) 7 |1 J7 q6 U: \( d* {. {3 L: M
{
; e( z4 u0 q$ ^0 ?# h' { WScript.Echo("Could not load Model!"); 5 R9 M v2 G1 j1 V) F- D+ m( z
WScript.Quit();
* ?, {$ M9 ]! W3 f( g$ p}
+ C4 ?4 w0 s" S" s9 D* X$ W1 D
# f3 a% N! ~$ z. o: d7 p' d" utry * k) F' y$ A" i8 g' Z
{
7 v/ ]- g' z% t; j2 E simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: a* D; u( h% s: \4 D# c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; p2 B; C) f2 M if (r == vbCancel)
! p Y7 }8 t* o+ i% h6 l { : l! E- R& K3 z
simple.CloseModel(); . t0 Y7 ^) V% g& l6 ]
WScript.Quit(); 1 P" \* A/ e" C- {
} " O" |+ |) w6 x& B2 G3 M
} : S* f) ?, b4 S0 i
" @) ^7 m/ @, }8 l
simple.StartSimulation(".Models.Frame.EventController");
/ @7 S0 U! O8 }% X H ) m4 }) y5 e. [5 A
if (simple.IsSimulationRunning()) . f' G# }0 H3 D& E8 x$ r& f
WScript.Echo("Simulation is running!");
$ D' z6 b! q5 O) n 5 b! t0 u( R) ~
// Wait until simulation is finished % A9 U/ Q' U. C4 D, `' A- u9 R
while (!Finished) WScript.Sleep(2000); % ?8 O; Z7 o* b: \+ D% z
& n6 ]* o: `. w j8 l: K$ a
simple.CloseModel();
3 t( v/ H* c% V nsimple.Quit();
% R2 N- o! ^1 p2 [WScript.Quit(); 4 c2 z# j% A4 _& [! B& B
( T j& m* ]" _! \& f g& o
* t- P3 n3 x; X5 P- Y9 C3 ~# Ifunction RemoteControl_SimulationFinished() 7 Q% f! c! C5 Q) d7 q4 T
{ 5 e2 F, \! E0 b8 l
WScript.Echo("Simulation Finished!"); |