Example of a JScript
, B6 J! |8 B, X1 E+ x: ^$ Uvar vbOKCancel = 1; 1 r' m4 S2 l- R: e# G) [
var vbCancel = 2; 4 q6 }; H' Z9 j0 f
var vbInformation = 64; : M5 y) l/ C( a1 n
var Finished=false; 1 k3 ?& @2 \' v9 l* ^) @: i
* k: \& ~7 v/ w) \+ t: Z3 g
var WSHShell = new ActiveXObject("WScript.Shell"); + M. R& r0 y d
9 V7 }( a# r6 Y- B: o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, y% [3 l) B8 E7 G " `' v- A; G$ V5 Q# S% f! a
simple.SetLicenseType("Runtime"); & \9 S+ d8 Y& g7 M! l5 h
' @' W! M% b% N e7 p z# L8 U) f
try H: U/ T9 C' \: F7 P9 a
{
) ^: @4 d" ]- h/ i // Enter the path to a model file!
8 l$ @+ _% I9 }0 l0 ^' s8 s( r simple.LoadModel("C:\\Models\\Test.spp"); ; M5 r" a! d( n' J* a
}
q( z& u$ `( a- h9 @. A- Ocatch (e)
6 n9 p( M. {; r/ F! T{ ' Y0 ~; A$ y2 V5 O' W$ ]# a
WScript.Echo("Could not load Model!"); ! I& c9 _# c3 w/ {! o. y8 o3 E
WScript.Quit();
8 `# U. z& u# M# O$ k}
% E% @. {8 j+ F2 {9 O5 K
( C. V# g/ L" N0 ?& q/ ~( ~5 R7 Ztry 9 n0 ~5 \0 T1 Z- i! ^
{
+ L. E# G( ?# l: u* u3 U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& M3 N7 Y! N- ]* N8 l i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 k Y# N6 M; @ if (r == vbCancel) , n+ h4 y8 p2 p) J. I6 \. @
{
; D8 |3 U7 Y9 b+ W! G8 w7 i+ c3 E" C simple.CloseModel();
: {. K4 M( k" A1 B. k+ [ WScript.Quit(); % u3 f3 p( E' h% l3 n) n1 G8 _$ v6 Z
}
# }+ Z) _/ B$ H1 }! ~}
5 y) V" w3 h0 I# q5 A+ a) S # \0 e5 |% }, A8 B/ Y
simple.StartSimulation(".Models.Frame.EventController"); 9 f9 V. n ^2 C1 C+ l' f
0 F1 W2 e& ]: k6 P5 ]if (simple.IsSimulationRunning()) ' e, D9 }. E- K( q$ U
WScript.Echo("Simulation is running!");
( Z! c# i$ n* o
; h: f3 v- \5 [5 C4 z// Wait until simulation is finished
4 x8 E* [9 X& ^4 C( H$ vwhile (!Finished) WScript.Sleep(2000);
; c r$ s# C, k8 T5 t 1 L/ l6 x* j* S/ n( y& t
simple.CloseModel();
6 _# w5 r2 ?- c: [4 |/ h6 ?. ysimple.Quit();
0 D, i; Y0 C& {2 oWScript.Quit();
/ W! D. b- h( c% D( n % u" G* |8 Q4 l4 W
! X' i" c E2 I% F; d- h1 ~0 K
function RemoteControl_SimulationFinished()
/ ^! V+ v3 P' N& A$ ^" y{
6 P. E) r b# x4 b' h0 v! H, K WScript.Echo("Simulation Finished!"); |