Example of a JScript 4 n, D+ b; F8 Y+ |" |! b/ F
var vbOKCancel = 1;
, w8 O9 B; U. x3 E# pvar vbCancel = 2; + M0 j$ o# o- Q3 }8 i- L" b
var vbInformation = 64; + e6 C4 m2 b& h
var Finished=false;
[! S* T6 I0 n* h" }
5 S, O+ Z. | T/ K, a- @2 }var WSHShell = new ActiveXObject("WScript.Shell"); / P) e/ x! i! d; a3 ~
3 X$ H4 u1 }0 Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ w7 J5 \* Y5 C, S+ E
" d1 l- ` e& g& o; i* \simple.SetLicenseType("Runtime");
; _$ M J3 p9 j( H6 B9 @ ; V: P' _+ b( Y, \2 p/ o/ j# [
try
8 z* D" P7 V q O5 Z{ * ] x X4 V) v" T1 R, e
// Enter the path to a model file!
! o1 |' ~, E; T X9 o simple.LoadModel("C:\\Models\\Test.spp");
5 d& k# N T( J @# I# C* \- C} , ~* _; T, a5 z( b3 `! l, J
catch (e)
5 g- R7 \8 J' t' U9 [{ 0 }: c( B6 [9 `3 H
WScript.Echo("Could not load Model!"); ) ]- R7 N; |. F0 S/ f, k% K
WScript.Quit(); " R7 I1 j1 U( u$ F& h; w
}
/ w- V( ?3 P& g; I- w y2 }8 s 3 _2 ^& k# p7 _# Q9 U" `
try U. \2 D2 Y# v1 Q- h
{
+ O5 t' Y9 w9 Z0 Z, p# O( Q( l8 s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! T4 M' M0 |/ c3 k3 m
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! _4 W! \ a* @% I$ c4 d) f
if (r == vbCancel) " K: v; E$ E( k
{
5 s! ~! G! ]6 \. J simple.CloseModel(); + B! L9 v/ L$ x7 ~7 e6 q
WScript.Quit(); 6 _8 T/ N7 F- M. J; g- e5 i
} s/ q! V8 v0 A# x' A
} 2 o; i% r6 ~' _. L
7 j% m0 n0 [; n; r2 @* V
simple.StartSimulation(".Models.Frame.EventController");
% O7 |9 I7 m" A% `3 }
/ a) T+ Y" Q) l3 {if (simple.IsSimulationRunning())
- ~2 X5 W0 [( N& K$ i' W' U' j0 l WScript.Echo("Simulation is running!"); 3 `$ x: u' M, T" ~1 h- s/ V: d
" L" C% ]. w n+ ^+ m! F: }+ c' i4 b// Wait until simulation is finished
+ S) X' [4 P$ C$ ]- Z$ w1 R7 _; S' Awhile (!Finished) WScript.Sleep(2000);
j( R7 [& |; @0 h
" s# d/ n& c5 {! |$ q6 P" ~simple.CloseModel(); 4 F: U z @9 \8 [9 b8 i
simple.Quit(); 3 d% I( o9 w1 L% z0 q
WScript.Quit();
& ]" c/ J- ]0 O5 k, n
7 [# ]0 c3 z! ~8 ]3 t# C
, @" A$ b, s$ U* }( C2 afunction RemoteControl_SimulationFinished() 1 C, s6 I% P" n; K, @8 w
{ ! R4 F* \6 [. W" r# q' [% l
WScript.Echo("Simulation Finished!"); |