Example of a JScript
- b0 o% m! x" [var vbOKCancel = 1;
4 ?& W7 Z& c) u; |3 Svar vbCancel = 2; & c& A8 l" M0 i x+ w" M0 g
var vbInformation = 64;
8 \0 o' J( W9 E. N9 Z: ?& g+ Hvar Finished=false; 1 i/ E2 V/ ^* {; q' J& H( p
; K" Y }! A! n2 |, q8 }: q
var WSHShell = new ActiveXObject("WScript.Shell"); & q( n: s6 W) J# r
, \1 F5 {' Z E
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) l, r% s6 A) }1 F; t
4 c/ m9 T5 s, Y0 ksimple.SetLicenseType("Runtime"); ; T- U% E' }$ h2 M) r
5 W: j, C3 |9 j7 n( G, p' ?! w, m+ |try
' k) R& ?& V9 @6 z6 B* [{
4 w( s4 b T( J4 s* \( u* T. Z4 N // Enter the path to a model file! : `& z6 X$ B) d# A" R( p
simple.LoadModel("C:\\Models\\Test.spp");
* s3 J; B2 P4 E}
4 k( s" ^, Z0 d5 ^catch (e) . B, \$ ~ x, s X! t/ `7 D D7 x3 ^
{ 8 f4 v7 S( G; `) n; k9 B, E+ X
WScript.Echo("Could not load Model!"); 2 ]% v, |6 _0 h1 |" B+ U
WScript.Quit(); 0 f# q4 c5 m7 x& t# N
} b2 Y$ _6 X9 ~5 |1 q% W4 ]; Y% J
- \( F8 p# d0 G; H/ n* k- j x
try # ?1 P! R9 X/ J# Y3 Y. o
{
; b5 K5 _+ S# f$ O s m6 K simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / Y0 Q% Q/ j5 M3 F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! V) [1 B) t2 R' m if (r == vbCancel) . t0 U2 J3 N2 c- `" d
{ 6 Q3 v/ h; g( p& `
simple.CloseModel(); % i2 }% d; `5 H W
WScript.Quit(); ( ~5 E7 {! ?& g7 N; U
}
0 b3 ~" q7 [# K4 V Y" o# R}
+ Y0 R0 z* x ?
1 R+ Q$ v& k! b) E z+ Xsimple.StartSimulation(".Models.Frame.EventController"); 6 @* @! E4 [% Z0 N2 H& c- u
K; T$ y# G" {if (simple.IsSimulationRunning()) 3 X0 n! R9 z; F( `
WScript.Echo("Simulation is running!"); x8 a. n9 Q9 s! `4 e2 a
2 t. g7 ~0 y/ s* G- ?// Wait until simulation is finished ( `; P6 `% t, I2 |% P5 C% v% C
while (!Finished) WScript.Sleep(2000); . k B0 j* F& A7 U$ b
3 t4 \8 I" {$ H$ ]" z" x0 V9 |' I* B
simple.CloseModel(); % @- M6 j, Z1 K
simple.Quit(); & x/ c1 v: C/ }- C
WScript.Quit(); & I; \( x$ ?5 `' B. d# X8 b% e9 X
' T" {$ _1 L+ N! \5 V( I1 E
3 Z4 g7 k" ~, T( Efunction RemoteControl_SimulationFinished() 1 m: y5 e7 A. u' L3 ]1 a
{ 8 m. \; B/ I/ }) u( j/ g% N) [
WScript.Echo("Simulation Finished!"); |