Example of a JScript
9 ~ m, o2 r7 e0 f5 R6 p' S' j [7 t$ \var vbOKCancel = 1; 7 }) R/ B, Q9 ^( [8 Q
var vbCancel = 2;
: P/ N& @! t/ c1 ^, H c! Z" lvar vbInformation = 64;
! p! X: W( ]% E# y: dvar Finished=false; ( N$ h5 B3 Z3 t* h6 B( C3 |, w
; @4 W6 E+ X3 Z q6 evar WSHShell = new ActiveXObject("WScript.Shell");
( Y! a0 |5 N3 [0 R " |+ E- E* v* }5 _* T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) f8 Q0 l+ }+ ~/ R- g9 @
6 s% V" N8 M) S; O: ksimple.SetLicenseType("Runtime");
. u! T& Z7 W( x, \" B 0 [% T* I/ W' c
try ! G8 C& `% D4 t( e( E3 Z
{ : ]2 `9 |; E$ f2 C* u
// Enter the path to a model file! " ~, O; X2 S- | ~" \/ m
simple.LoadModel("C:\\Models\\Test.spp");
0 u+ {! d% _& ~8 p; v' o0 r} 6 ]$ k4 X# _- t) K" L
catch (e) 1 X r6 k+ s: ~' {/ Y
{
& f" l9 J& Q+ v9 [$ S WScript.Echo("Could not load Model!");
) {3 I' M6 i' j3 }6 | WScript.Quit();
( W: U7 G: T( @& B- _} : v) T2 H1 z7 | k
" }) ]$ ^0 A, d7 g3 b( B" `% Y- [try
; [& s1 `- C' Y, R0 S3 y4 \{ , L/ l3 |$ N, R$ |: W" L/ Y5 _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 V& F% G( t9 U* h4 x3 f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' I m9 }! o: w5 q, J {, d! V
if (r == vbCancel) : i$ \( f. w1 t7 g; I
{
2 k' c8 ^" M1 B! b/ ~, }' t9 S simple.CloseModel();
! B; k. \8 \* C% O WScript.Quit(); ) W" \" @% B6 }$ j
}
/ C& w0 _- |! K5 z. P}
1 H! V1 a5 s& m1 r
5 S6 ~* |# t$ V7 T: j% X. N9 Xsimple.StartSimulation(".Models.Frame.EventController");
2 B% S+ Z- B1 _/ H6 y* B- j; \
' ?7 r4 ?+ c/ N+ n# Gif (simple.IsSimulationRunning()) ! c" J1 W5 s! A
WScript.Echo("Simulation is running!");
3 i) k6 v2 B4 e0 l# x( ~ , U" s' g6 e: A7 v& u( b( ]
// Wait until simulation is finished
3 h' V! w) ?5 Owhile (!Finished) WScript.Sleep(2000); ! K t c8 E- k) g& s4 e2 R: _
& L i. B# r5 h% M. A
simple.CloseModel();
5 ~9 u, ^( f1 k% k Asimple.Quit(); # s6 ^* |; j' w7 A( [
WScript.Quit();
; t5 z! a8 b& e( K
: J4 M7 D! E1 \4 b& `* ? $ `, g3 m) g. v; o: E2 m
function RemoteControl_SimulationFinished()
* D* C3 q' N0 W5 }) ^{
g2 g0 h1 ^( A: o WScript.Echo("Simulation Finished!"); |