Example of a JScript
* _" {5 Y+ X% S- X, _0 C, Avar vbOKCancel = 1; & P3 I0 }- f) n+ Z% T
var vbCancel = 2;
0 e( Y3 ?' }: P" e: {0 Svar vbInformation = 64; ) \ r0 M$ E; Y3 v
var Finished=false; 8 O* @4 E& M- F* {( K {
4 [6 A1 `, w: {7 Tvar WSHShell = new ActiveXObject("WScript.Shell");
0 b% [1 _$ |9 q" H ( Y- w' Z: Y" ^+ x, l/ y N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . K2 f1 t% u3 _( w: M" [
. g2 d! {$ M3 ^$ [; o; |
simple.SetLicenseType("Runtime");
; I# R. V0 M3 N 5 K8 U% R% j+ T9 n O+ e5 W
try
& O# W" H9 G. U) U0 Y4 b9 F. j{ , ^% w( L. l$ L, D3 a8 {
// Enter the path to a model file!
/ }* }3 g" q5 Q1 v0 k$ s% ]) m simple.LoadModel("C:\\Models\\Test.spp");
+ l* P3 D. u1 j, W P, k} 0 i* b# ]# K" F( ?; o
catch (e) / _+ } L" p4 p- ~$ z, T
{
& t. v/ \- H- r" v! ?: G q WScript.Echo("Could not load Model!"); + w# d" h: S( h# O C' i
WScript.Quit(); ! |' Y) L: Q: z3 i
}
, d( n" I- @" Q+ ?" R+ Y
`6 ~+ [& H0 c7 vtry % R: Q# v) i+ g
{
1 o2 a' n& f: I8 {$ k8 g5 | simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; O5 c8 f5 |$ o5 B' g! T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 ^. ?3 Y) p: A. ~# G. m
if (r == vbCancel) 7 ^6 J3 [ p1 v% b! W2 }
{ 8 w. F5 g0 K3 t% K! r* F# L, L
simple.CloseModel(); + N% C/ ^% q1 n
WScript.Quit();
2 w+ k) {9 P. s- i. V+ y4 ] }
/ Q3 z6 W. U; }: m# { ]} 5 i. o- K7 B1 L$ U! |5 F6 v
! z6 O5 G% {2 y5 W
simple.StartSimulation(".Models.Frame.EventController"); 7 g& l' G& B/ s0 d
: o+ u) y. z& t3 Jif (simple.IsSimulationRunning())
' ?% [. }6 b' N6 O WScript.Echo("Simulation is running!"); 6 M# ?4 @' P& T
. }0 T; V! B6 y9 T' P) W6 C
// Wait until simulation is finished 2 M5 B$ q* k5 K& R
while (!Finished) WScript.Sleep(2000);
6 A- @/ g3 D* A' r
3 K4 B. r+ z6 M: Z2 U, n: |simple.CloseModel();
B, }, v) n7 P8 m' ~' tsimple.Quit(); 3 t4 R8 g# b. k0 o! n( T$ E7 n. Z
WScript.Quit();
! ]3 b' W9 `5 A2 X7 h' i& ~ ) L/ I6 C! O0 W- p2 S ]- E
8 p( b j$ L3 e z& k) `
function RemoteControl_SimulationFinished() 4 [* H0 d9 E; k- B# O
{
8 t: v8 J) x7 w* s WScript.Echo("Simulation Finished!"); |