Example of a JScript * c" W+ M* ]# \6 E4 }, M" Q
var vbOKCancel = 1;
# e: U( ^% q4 hvar vbCancel = 2; 6 V/ U8 U+ \7 V6 d5 U8 k* u
var vbInformation = 64;
e+ F3 ?0 @/ B7 W9 F1 F9 O0 j0 nvar Finished=false; - |5 V$ _/ |+ z5 j0 |! S
. n; w8 Z" O3 mvar WSHShell = new ActiveXObject("WScript.Shell"); 7 C) |7 M: Q/ J
" M: R: ]9 g) T0 ~/ i j9 n2 C
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' c4 s% M+ n6 w2 ~7 ~9 H/ T 3 S+ ]; s9 F1 J6 v/ A+ f* A( v7 R
simple.SetLicenseType("Runtime");
5 m9 P" R) o0 G7 u1 I7 w2 X
$ |; T( ^% |0 C2 i) M6 }7 utry
: W2 W7 S1 M! c3 T" W' {{
! ?' E/ |4 k. o) W! ~' A4 w1 l" G // Enter the path to a model file!
7 |4 f8 U" \0 j4 s& f' w' X& N$ t simple.LoadModel("C:\\Models\\Test.spp"); % W& y' t: R4 h1 d9 O' M1 G, Z
} ( W; A7 }; w! s1 V! s
catch (e) & W$ y# P# O. E
{
+ K* N# e5 B& I; ]3 n g- j/ u& l WScript.Echo("Could not load Model!"); 5 k ]8 M; A' b/ V$ V6 R' a5 y
WScript.Quit();
n' y$ \% z6 O8 | x/ m}
8 [7 w" p4 F9 k7 S4 o' n
/ R6 V9 Y9 ?6 rtry
6 z9 {& z' ]6 h4 ^3 ^{ % `' w7 t7 K8 `' I5 B+ z& D7 k; x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, X7 h, e; h# V2 _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 N' r% ~3 A) Z! A/ P& l1 P if (r == vbCancel) . U8 d9 ^: t" h: |2 o( k
{
& p% z* K; ?+ j. d e' C/ F simple.CloseModel();
; Q, L6 M: Z9 t& T WScript.Quit(); & y# J C4 m4 K6 K/ o
}
u; D, a8 d# ^% |- B% g: t& H} 6 S- p/ {+ i8 B* v+ z- K# N( J9 s
1 p% Y! a: c1 ]1 ]0 a+ t, N! ^4 h
simple.StartSimulation(".Models.Frame.EventController"); ) W; r& V! V. L7 ]! A
8 y# K5 F6 {: c( Y0 ]! p
if (simple.IsSimulationRunning()) : J' L0 u. m9 b1 I
WScript.Echo("Simulation is running!"); / g' P4 j4 r. N: j
, o- Q' h Y2 k// Wait until simulation is finished " i* `% v1 k; t) G4 C3 ^
while (!Finished) WScript.Sleep(2000); ; t1 R! g) ]6 @- Y$ m0 l; O
2 a" M, ]" o# w/ jsimple.CloseModel(); : ?+ Y8 }! }% Z! y; t4 y2 ~ x
simple.Quit();
% s/ e+ Y% {9 uWScript.Quit(); ! K) y( y+ C9 h
6 _' d& X2 I+ x1 Q1 ?+ _: @+ [
% h r+ A( Z" b
function RemoteControl_SimulationFinished()
% H2 K- L/ E; \% ?$ F0 Z9 A{
1 [; X! Q& o& ? w- a WScript.Echo("Simulation Finished!"); |