Example of a JScript ! w: P) Z; ]9 \( d9 f9 U
var vbOKCancel = 1; 7 C, y( I% o5 ~/ H7 ^$ P, a% G4 [
var vbCancel = 2;
/ j. G& b' A! j% \var vbInformation = 64; # z6 E; n% g- C4 h
var Finished=false; / p1 B1 Z5 g' g/ }2 p. O2 {/ x# R4 j
8 o! C) ^: g4 ?$ ovar WSHShell = new ActiveXObject("WScript.Shell");
. \7 i' ]- P0 }& k z Y + W& L' | O% ^6 w
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 m$ w# G- [. [5 q8 }
- V, b1 |1 Q0 T
simple.SetLicenseType("Runtime"); & {, v$ o4 U$ ?6 J
' b0 V$ V' s* e' ~; L3 e/ T
try ) W8 l8 P) ~# u2 n0 k; f6 c
{ 8 l6 j6 \% e' r. M! J8 A
// Enter the path to a model file! * L2 O) R2 t0 u+ a. S K
simple.LoadModel("C:\\Models\\Test.spp"); - x! ?, @; m; y# h- v# r
} # j6 q+ t1 b1 N9 L0 G P0 I: Q
catch (e)
& P' K S8 u$ Q; D) U{ 5 F8 V+ C0 T# C9 \4 ]) ?
WScript.Echo("Could not load Model!");
" L. p% p- _, O: Z+ Z X) d WScript.Quit(); ! G. i* P) r& M. y
}
) Q: x1 G5 n; S! S' Q0 R! n, I
+ Y7 a( A9 S, ^3 e% j( h! I1 atry
& K+ @1 e/ }3 _{ 6 p- v. S8 F `8 \& ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % x0 G+ L8 l$ l* d7 a8 y4 x0 a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + O4 _3 t7 |2 a. }, B$ A
if (r == vbCancel)
3 K! b" H5 I0 ]+ P( S( k {
. o" S: A% w( b7 u9 E simple.CloseModel();
8 m& O* w- t3 {7 y9 B& W$ \; H WScript.Quit();
; l: r% f. t) z }
% T2 ~* I5 P) @: d0 w0 V" d/ h}
3 x O$ r7 U3 n( F, G. M 1 q1 U( F8 T$ T8 h$ o
simple.StartSimulation(".Models.Frame.EventController"); , p+ o0 _/ s2 h% @: |2 O8 W( _
( @1 b. U: a. H# r" G2 ]- P
if (simple.IsSimulationRunning()) ! t0 `5 J1 J4 ]$ w* B0 Z9 V/ G! \
WScript.Echo("Simulation is running!"); * E2 j9 g: [( N" W+ I5 @: ?
, F% P) i9 ?2 B8 l; M% `! r7 e: O, ?1 k
// Wait until simulation is finished
6 k! X0 ] P" {, Fwhile (!Finished) WScript.Sleep(2000);
! `4 U% Q+ P, A5 \, {8 m3 a# E
' G* J/ `. f) l Ksimple.CloseModel();
5 u9 j6 o0 y3 n+ q* Usimple.Quit(); / K* ~: n- Q7 K) m
WScript.Quit(); 3 S- D9 L, b9 o% }
) N5 H* Z+ u9 \: L7 [: y; |' i+ ~ 6 t2 ^( S- Q* b: t+ v9 k, T) \
function RemoteControl_SimulationFinished() # x. J# {$ S6 g" H @5 |
{ # ?3 ?7 x1 `! t) E1 S" G/ o- ]
WScript.Echo("Simulation Finished!"); |