Example of a JScript
5 @6 q5 v* z- n3 r1 s$ pvar vbOKCancel = 1; $ M( ]6 R+ Y2 U! w
var vbCancel = 2; 4 ]& c% B0 R! ?9 o9 F$ t E
var vbInformation = 64; 0 E: a, @" O! Z! Q8 F) H: i5 R
var Finished=false; . u5 W& J% R) L6 y
6 L; h/ a5 k* w8 O* ]2 `1 t1 p
var WSHShell = new ActiveXObject("WScript.Shell");
2 Z: t o* x& R" w, }
; _) o; {) J. O- O: L& m9 Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 I- ~$ n1 S6 W4 d, X
, a3 ~2 y9 e# h
simple.SetLicenseType("Runtime"); 5 J; ^6 s m# E3 j+ L
: e9 r! B+ Z& R% U
try % R8 h) O' ?" n& ~) K8 C" I
{
0 B2 {7 x8 p/ t w# ~; D' k // Enter the path to a model file!
k2 i3 b- N& k. _0 R4 Y simple.LoadModel("C:\\Models\\Test.spp"); ' Q b4 L* |: q" {# Z9 r0 n
}
+ G, ]4 E- V; p9 O. w# c* }$ o* s# ?catch (e)
( x/ [- j# E/ f) s) b% W) x{
. ~: w+ z' O2 b+ S* P7 ` WScript.Echo("Could not load Model!"); % g; z7 z- N4 i+ _, A$ h
WScript.Quit();
$ @) C0 ^7 f0 ~0 A9 S/ o6 D}
" ?( e$ ]7 W7 `5 h 2 N& j/ y. X, g- u# H
try
; Z1 P. U& E' X9 Y* U- E( \{ , Z# y; D9 u* G( R4 m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' e! y7 G; l8 A+ S- o r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . e; N9 [0 `0 o; D
if (r == vbCancel)
: T7 T+ ^; C& L* Q$ Y. E ]5 T {
. i8 r6 ]" @" ]: a simple.CloseModel(); & H3 T+ S8 [. L& i5 L/ G
WScript.Quit();
# C& D) b2 B9 [8 ^ }
7 k* r5 c/ V- o! r. {: r}
$ H7 \ a/ d/ ?) ]) z" Z5 q / W* O; {0 g: A4 y' }9 g8 ?: s
simple.StartSimulation(".Models.Frame.EventController");
5 ?/ h$ L9 i0 {7 I* V7 `: U3 w; G " G ]( t3 L6 p' P
if (simple.IsSimulationRunning()) 7 c3 @: k* P0 j& c: @% q
WScript.Echo("Simulation is running!"); ; b, d3 C, T8 E. E5 g2 H
2 \: e' g/ P" M' Z% [
// Wait until simulation is finished 2 ]0 M& G% d' y; Y' [
while (!Finished) WScript.Sleep(2000);
( n% t7 |" q. M* { 6 E( h3 b$ @) H! e
simple.CloseModel();
- m) {8 J1 y. {$ T4 i o8 Bsimple.Quit();
9 U9 ~& A. Q ?% G" cWScript.Quit();
* I; F0 J5 j3 B/ M% K 1 d |! l7 T5 M6 A
6 B4 ~) w" E" {
function RemoteControl_SimulationFinished()
& T, X5 l1 a# \/ ~$ W{
. ], v9 A F; A' L WScript.Echo("Simulation Finished!"); |