Example of a JScript , V0 t& ?2 k! K
var vbOKCancel = 1; . z' B+ ^6 }1 H
var vbCancel = 2; ' x# u+ x h% K+ Y0 B1 p3 z/ \& @
var vbInformation = 64;
0 x' \ Q9 ~7 x4 |% ~var Finished=false;
- z7 ?2 u6 ~, D
0 m; G$ s3 }4 J# u3 k5 m/ dvar WSHShell = new ActiveXObject("WScript.Shell"); 7 x2 C C' y& j. d: H
3 j' k/ {) g: Gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); [2 l l; y+ ]6 W6 n
# q) y- p7 J' G" w( m9 H7 usimple.SetLicenseType("Runtime");
& f' E) M. ]" w8 _2 ^1 U8 T& Z 2 w! ?+ [8 K5 \4 B3 O ~
try
* p0 C) C0 K* \" i/ M4 w{ 8 B1 L; A7 o. ~: h
// Enter the path to a model file! 8 ~ l9 h2 z3 d% |' b
simple.LoadModel("C:\\Models\\Test.spp");
0 c! _ m1 W* q, P6 e5 } M% x/ C} 7 ]* S5 p1 {# f; i8 Y4 Q# _. Z: O
catch (e)
* |% a) u% @0 o$ `+ L3 A5 f{ ' P; U1 W! F: \
WScript.Echo("Could not load Model!"); & W9 u, P0 P6 _" L- O: v
WScript.Quit();
( U" `/ U; o# w& z/ \' I}
/ `- j {9 p: T5 t o) v% @/ Z, A: d
try
" I" _! e S! j5 ~: g- u/ A) X{
6 |$ ~3 h. b5 Q4 j- ?! A1 i% U6 x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 Z5 t# ?. ~* O( D% @$ B& d8 A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % h+ E% g& J" Y$ h. g# P ?5 t$ J
if (r == vbCancel)
" i& c: e7 I. t: I* n9 F { / l/ B# M% D) g- u* m
simple.CloseModel();
$ j4 G# I1 d: c% F& x# q WScript.Quit();
! f$ F( h! \4 k8 I) j }
: }* a4 E ~0 P! w}
- ?) Z0 N; g7 L 3 Q0 A' e/ o# _
simple.StartSimulation(".Models.Frame.EventController"); , } P; z l1 \! o
: ?1 _1 ^5 {. M( g) Eif (simple.IsSimulationRunning())
* G7 k9 b! h6 U5 T WScript.Echo("Simulation is running!"); : }& g6 T: N1 d' O8 l; L) }
# ^ {3 `8 Y0 c [5 N! d! M' C// Wait until simulation is finished
; w8 i* q& |2 B1 k' zwhile (!Finished) WScript.Sleep(2000); ) G5 r b( c" Q' O' R
% F8 D0 n& N) X- Q$ R
simple.CloseModel(); P/ p4 `% w* @5 Q# X" d4 J
simple.Quit(); / {! e% ?0 B1 K4 u
WScript.Quit();
, J& [0 p( {: l7 N2 t) n/ r& m
2 S& K$ D6 {5 X4 Q' ]. u( e1 n3 b ) g1 R2 C' s' ]: @+ P
function RemoteControl_SimulationFinished() ( B4 t1 q4 `) `2 C. F
{ # k1 F! X, X3 m+ `5 t& B* G' V# e4 e+ d
WScript.Echo("Simulation Finished!"); |