Example of a JScript
3 c- D' f- T. T1 Z& F! V: \# Evar vbOKCancel = 1;
; n5 C' n3 v; f1 q$ z8 k, s6 wvar vbCancel = 2;
% ^) [& v1 U5 M# cvar vbInformation = 64; 2 ^9 m* S5 v" G( [, v
var Finished=false;
1 b) o# w$ _. k& Y
' [! w' E1 C5 L* @2 t. |, v: j# }var WSHShell = new ActiveXObject("WScript.Shell"); V& n# C3 u g+ s4 i$ _
* k( F4 |4 Z X0 E, B: a8 o2 a. b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 k* a. r3 y3 {0 W9 O; d
Y' l0 S" f! n2 Wsimple.SetLicenseType("Runtime");
, |" N6 P1 V" `8 X0 P
1 l% O3 p G+ Q' p" V0 g( ktry
7 ^8 @8 i& j( Z6 _7 ^6 K{ 7 W5 J$ J$ O5 y4 ]0 e6 I5 @% j4 Y
// Enter the path to a model file!
t' c. ~9 x. o4 q simple.LoadModel("C:\\Models\\Test.spp");
' D+ U, z. F% _7 B}
+ r+ u4 L' `7 q0 ~8 P4 jcatch (e)
, J' l B3 ~+ a! M9 o{
3 G' b$ B* o* N. Q* Z8 S: ^6 w WScript.Echo("Could not load Model!");
) D5 b6 ^! |/ U WScript.Quit();
% p; G, V B0 D- r6 W% }: ?} 1 k. V4 U: H' o; U7 k, R) P# G8 c
* n1 q" ~; ^) Jtry U3 J, K/ m2 k3 J; C4 ^* {0 U
{ & q8 P5 }( T" ~9 ^- g' h1 p
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' |5 L7 S# b$ R3 ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 @& o7 A A. c) c if (r == vbCancel) / T( w/ k! L# F: k3 ]& Z) u
{
$ Y) I' m7 Z7 z- b% d0 W( \ simple.CloseModel();
4 S/ A8 W! Y4 G5 ]$ J3 T WScript.Quit();
, l# `0 D! L8 j* { } 3 h) R/ O2 d* [
} * z, D+ [$ }4 E2 s$ [
' L& t: b+ v8 J
simple.StartSimulation(".Models.Frame.EventController");
, m F+ J0 q6 a; T a# z W! _# ?! p& Z, |0 K
if (simple.IsSimulationRunning())
* K9 W1 K' H1 Y9 q. d WScript.Echo("Simulation is running!"); + S L) g% c d- @1 R6 Z1 d
) x9 Y4 Y: R) U& r }& F2 |: w8 O// Wait until simulation is finished
i. ~9 U4 E1 X! f# _0 S! U( v; F9 pwhile (!Finished) WScript.Sleep(2000);
- D7 F7 C: F7 J+ Y
# h. Y, v m* L6 d1 n) O; e! ?& |simple.CloseModel(); ! I s' Z+ T# I1 B5 {) m# Y
simple.Quit();
. D8 k% b- q n3 {8 fWScript.Quit();
- i2 G: D& u6 V. R. z; o* g% D o; y
2 A# P' a& I7 ~# `' Q/ p
9 L' d) \/ R% e sfunction RemoteControl_SimulationFinished()
2 ~& \; ?: q& D/ g{
* V" D% }, ~3 h5 L1 r) T WScript.Echo("Simulation Finished!"); |