Example of a JScript
' s: B8 C; `: y) J3 h' S& }4 ^* ~- H1 evar vbOKCancel = 1;
; K4 T. u. F1 Evar vbCancel = 2; - N* K# E; |* }4 s
var vbInformation = 64; ' E) ^8 Y. M y5 ?9 d
var Finished=false;
2 T" n# z# o2 V0 B5 M . d+ r* I2 }: `( Z& b( Z8 H
var WSHShell = new ActiveXObject("WScript.Shell"); * ?, V6 E( g: J
. f; x- e2 t% e* |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ L+ K! L2 C; h1 a% ^7 B' p
; O2 V: t8 e9 S2 A- s7 H! o
simple.SetLicenseType("Runtime"); / D" J2 z0 P& j: v+ ~# p
; ?" R, b- l$ O5 qtry 2 ^% K, Z# U1 |
{ ! _, e' Q m; N8 ?
// Enter the path to a model file!
0 R3 Y2 W) B$ f simple.LoadModel("C:\\Models\\Test.spp");
" U! S7 c/ g+ X! b- o1 K4 P} + `3 T- C3 z* `8 Z$ z: z
catch (e)
; O' z( h3 x, x; g{ 4 N0 ?0 U1 |, C$ y+ a# C
WScript.Echo("Could not load Model!"); 4 `7 x9 H5 ?6 n' o0 z% G
WScript.Quit();
1 ^& j! f4 E5 w1 W+ Y. C4 A+ c; R}
, K; `- N9 |. [
1 j+ @6 Y- G; }% g4 Btry
% q8 y! Z O9 L{ 6 e; {9 Y* q# ^- g% o9 r2 ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ G( e6 f5 i& H7 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" U0 T8 b1 r- R. G if (r == vbCancel)
. A( O& R' g7 w; W6 D {
9 S4 p) g4 r# s9 n7 M simple.CloseModel(); : _* F/ u9 o( }; e! g
WScript.Quit(); 5 m9 i5 P$ D$ Z
}
9 R. Z! U2 c& P9 f Y3 I/ Y} + t6 _9 b/ J; V/ _8 X2 w; ]1 {
& K; f1 c) _1 s# }
simple.StartSimulation(".Models.Frame.EventController");
* w+ N7 \. D7 W9 e8 {: @ ! C7 U: A" R# g
if (simple.IsSimulationRunning()) 0 E, d3 [# _' i5 [6 N1 b
WScript.Echo("Simulation is running!"); " I* D! z1 q3 M3 f9 S3 @
, S# l* F F5 S' A% l- O
// Wait until simulation is finished ' ^$ \! m: V2 K+ {! ?0 C
while (!Finished) WScript.Sleep(2000); $ T. f% V& B. D0 h# q$ E
+ \( I1 t; }/ V+ g: S. X# esimple.CloseModel();
3 e- j; J) P& I2 Z1 ^1 h; G5 rsimple.Quit();
* f5 m/ g/ a6 d7 L! NWScript.Quit(); & c% {$ l8 j- T4 ]6 p U$ _
* h: m' e+ Z# W: ^7 k
" {8 j5 e6 l o9 O. j, I8 tfunction RemoteControl_SimulationFinished() ]; x5 D% w1 R: X& s
{
9 _: F8 |; N5 h WScript.Echo("Simulation Finished!"); |