Example of a JScript ) Z5 ]5 l# Y7 p, N4 f& ^! V
var vbOKCancel = 1;
$ E, R) p+ F: R# J/ A4 @, j& `" u0 fvar vbCancel = 2;
& z; a5 {! M5 L, N' Zvar vbInformation = 64; 1 y, |- y1 k+ E
var Finished=false; 9 W4 n0 W/ P, \) x# ^0 }; v& {
7 y6 z7 o3 p) l
var WSHShell = new ActiveXObject("WScript.Shell"); * U2 H$ Y- ^* a
! l. Z+ w( h e8 Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; E- X% q+ B2 B$ [/ L
7 u D5 V6 c- s. ?simple.SetLicenseType("Runtime"); 1 n# Y3 j) ` E2 C' p
3 C2 B, i. M) n* {5 b( A: {# {try
1 K& X. E3 ]5 ?( ^0 v{
`3 f- `3 D* K6 o4 v# E }6 @ // Enter the path to a model file!
$ q* w6 D. m+ ^3 n5 J. R simple.LoadModel("C:\\Models\\Test.spp");
' @0 j/ G* h/ M+ F7 q}
' h: P3 X) `& R" w0 c* _" v, _catch (e) ! M: m5 A4 }8 w8 i( h
{
: i7 P' L4 P. Y3 ^% ^, ~- G B WScript.Echo("Could not load Model!"); ! M h: \- q7 ?3 F' h' C- R
WScript.Quit();
( q/ x8 H6 O1 V/ u( b6 Z& ~}
& X% P/ Y8 s2 R% e: ~% p
9 S: T, h' g! O& |( [$ T& a- R0 Ttry
" T& C) \( X$ j& M{
9 Q+ C1 `6 ^6 H2 @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! h$ ?) W( U% W- W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); H% e+ b6 z' b6 y% g. Q" \* j0 `
if (r == vbCancel) / ?- G# c: w" n) Z. d# }, n6 R+ e
{
; @ U) P6 l) t3 f8 L1 m; K h9 L simple.CloseModel();
8 r' L- @5 u2 S4 u8 X1 P( S WScript.Quit();
' c* b/ g8 G$ Q& ?$ S } ( [, |+ D% B8 Y% L7 M) \8 [
} 8 q8 [& Z2 a% k% K+ N; B Z
! J9 E+ N8 \3 @& A/ f$ |" Ssimple.StartSimulation(".Models.Frame.EventController");
5 Y* |! f+ W! R* c! L' s
. C. J0 ~ O% J% y) Rif (simple.IsSimulationRunning()) 4 |1 Z1 O* l$ u. ?# D- j
WScript.Echo("Simulation is running!");
6 I. Y- r7 q" S 0 j3 R9 E3 d4 z& Y; ~9 J4 F
// Wait until simulation is finished ) X/ M/ F X- r6 J; s
while (!Finished) WScript.Sleep(2000); 9 ~9 p2 h& ^# U, Z* ?& N4 ~
& l' ^- L, J/ Z3 ]simple.CloseModel(); . r- w$ R/ J4 w' ?1 ]1 D; |1 o
simple.Quit(); S) k8 I% }6 a( D+ w, Q; U; R& [
WScript.Quit();
( f% b2 ~9 l+ n9 n2 Z0 e
' ?% u( U9 Z. H; C3 Y& I: d 4 ]1 L0 {) U. B
function RemoteControl_SimulationFinished() ( Y. Q$ O$ o+ h5 p+ X
{ , u! i9 N+ {% l7 u# T% ` V6 Q% z
WScript.Echo("Simulation Finished!"); |