Example of a JScript
8 H V! U4 J- X/ gvar vbOKCancel = 1; . z+ `8 z$ o" U9 c' o5 Z9 \' K
var vbCancel = 2;
/ c% v- ^/ m# R: |* C6 }3 zvar vbInformation = 64; 5 R3 t0 h# z7 j' k; e. b
var Finished=false; , m( z3 i8 S1 g( b+ z2 K% L
R0 X0 L; ^1 K" A, A/ n( ?var WSHShell = new ActiveXObject("WScript.Shell"); x Y& G2 U9 j! V* x6 r$ ~
5 ?5 s4 H9 t. i O8 @: }2 kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# x; F1 A' U# |
7 C' `- ^0 K8 s& o E7 qsimple.SetLicenseType("Runtime"); - E! k3 A: @- ]6 x) f# }
8 R( O Y( }4 `8 Z4 u
try * T2 z# p2 X; d6 x n
{
; X# n" a9 ~; u( n // Enter the path to a model file! . z( Y( o" q+ L- \- ~
simple.LoadModel("C:\\Models\\Test.spp"); # ~6 d% T" ?( |7 n$ M
} + f& ]+ M& u" r0 i: i" O# O! A
catch (e)
# h. h3 ^ o$ s9 D# _{
& J1 }" {3 K# K, u WScript.Echo("Could not load Model!"); " G: y' r) q, Q, e% o% P2 g: A# p) W
WScript.Quit(); : U+ Z8 A8 |2 x1 r% t! D
}
" b! l) T4 z/ d : r) }+ ]. E3 l$ L* x
try Z; i' F/ e* H" _& w& {* g. p( ^
{ $ e: s5 x8 L+ d8 w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & B! a3 E" b' C& r& E3 b; t) w
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : {% u; ^" } p/ E
if (r == vbCancel) ; K' R+ K x" [0 |- M
{
# I! i6 [* X* y3 z# ]4 a4 ? simple.CloseModel();
V( j1 Y. G/ q# d WScript.Quit(); . p# t, O- N9 m9 \
} + t4 L3 j3 q0 g7 _' h% a( e$ L6 X' M
}
0 w9 w, {; N+ Z7 z6 q! z
+ T) s: V" w5 V0 j# |simple.StartSimulation(".Models.Frame.EventController");
~+ p& T5 C% z0 A! c
! c: H j7 B% Z6 e3 Vif (simple.IsSimulationRunning()) $ A$ [4 ^3 T2 T6 n, y9 m
WScript.Echo("Simulation is running!");
+ c2 j! T1 z8 q! L* [ + M8 u7 r A7 ]
// Wait until simulation is finished
; z* _& V" k3 i6 |6 T5 z* ~while (!Finished) WScript.Sleep(2000); ( K8 N' {- Z* A
4 S9 l6 z7 D/ r. V# x) [simple.CloseModel(); ! c, f6 o9 q( O
simple.Quit();
' A- s: ^, C" @; A2 zWScript.Quit(); ; }8 `- g8 G& h7 X2 a
p7 Q- F# k' {2 {7 h6 d$ Z Q! s. E/ y
: x* {: @2 l$ n6 g4 V: H4 K/ w# Kfunction RemoteControl_SimulationFinished()
* |/ T ]) E- w% g5 c. f, G1 }1 b{
/ i4 _$ s( [3 _ WScript.Echo("Simulation Finished!"); |