Example of a JScript
' d: ]2 K( o! `# U0 fvar vbOKCancel = 1;
! E: q: f+ A8 [! i. `( x3 |var vbCancel = 2;
% O7 d" N3 @4 R' D' {; @/ zvar vbInformation = 64;
( F# B, o% M3 h, Wvar Finished=false;
, T4 R3 o. L. d' b ; }. k5 P. j" F3 B A8 [
var WSHShell = new ActiveXObject("WScript.Shell"); # N/ N' I5 f+ t
* H! |0 z7 v; C; k% L6 bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 n4 R. q2 ^/ k2 @, I c3 w' U G P4 _2 b q$ U# x) ^
simple.SetLicenseType("Runtime"); - _) \2 p: q7 ?
d; m: y' p1 O+ p2 V; Ztry
6 j- i+ L9 k, Q* U# M+ u% [- c{
) o2 k; z% z [ // Enter the path to a model file!
" C- F5 n) O: s1 B p simple.LoadModel("C:\\Models\\Test.spp"); + @+ \0 N5 |1 ?" ]
} # ^$ O1 `+ a- y! h" J! U) x
catch (e)
5 R1 ^% x4 P# ?{
$ N2 j) A9 z2 C; o( U3 I9 b WScript.Echo("Could not load Model!");
8 M% H6 U5 @# ` u, Q WScript.Quit();
) r# L; A: q$ I0 ^" b/ f}
8 k1 g0 e" _/ ^$ ? - E/ B6 `# K5 T" m; n
try
) V% R A' J+ D C- c! O{ - E( T, G8 B5 c8 l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 p6 i* M4 n! | r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); t/ j0 e- N8 W7 h7 g7 A
if (r == vbCancel) * [* S; C3 S0 ~) T; D! q+ l
{ ) w% J: M% |* O2 X" N, `
simple.CloseModel(); - V1 S; P; r6 T9 y" O
WScript.Quit();
& k1 T+ A; u! y, H% @ } 4 Y% {. ^7 G* m1 d4 J! g" m
} 6 i6 b5 F$ V3 N
8 T8 t* q6 Q' c
simple.StartSimulation(".Models.Frame.EventController");
; j% C K* e, `. l- E / [7 ]7 X$ p2 o) Q9 j6 k
if (simple.IsSimulationRunning())
. G3 z' w7 y5 ~' w7 o6 { WScript.Echo("Simulation is running!");
, e4 @8 m: N& G4 c3 Q% o 2 U9 c b/ F/ ~9 E8 v
// Wait until simulation is finished
/ z/ z$ N, p" P+ t1 Lwhile (!Finished) WScript.Sleep(2000); & R) Y/ w, M: X- H3 @
4 Y8 T+ U" n3 z" ^' s9 j+ ?% P
simple.CloseModel();
9 s6 h8 q4 G2 @$ y# y' Usimple.Quit();
' h0 Z& j T2 G% A$ y/ F0 v+ ZWScript.Quit(); 2 Z8 s& m# l; X- ]7 g
7 X4 p) X& s/ }; Y, l9 ~1 J
|; q# G+ M' G" {
function RemoteControl_SimulationFinished()
) C) T& Z" v0 B{ ) k6 F; l% P+ `, s8 H
WScript.Echo("Simulation Finished!"); |