Example of a JScript % T5 e6 ?; W; `+ x% K
var vbOKCancel = 1; : L! X# V5 S1 w& T1 R
var vbCancel = 2;
3 G- r' Y' `- c! t+ }$ g. Wvar vbInformation = 64; * @+ f7 F1 d8 ~0 f) i2 C, g* [8 O( K
var Finished=false; 9 S1 Q9 I. {6 ^8 I3 j
& A! L6 x) y: R! p- }var WSHShell = new ActiveXObject("WScript.Shell"); 7 r$ g$ F5 S r D/ Y0 R/ K# ]
) |8 Y2 e2 n4 c. V7 Fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 n8 o9 C. M+ }! u0 \
4 ^$ B' L+ }, c' m& jsimple.SetLicenseType("Runtime");
7 E# d/ m9 p# c9 G' B% R! Y
# y9 h& V. I" H# P7 a$ Q- p7 A6 jtry
4 B1 {- Z' d& n{ I' T, S2 ]2 G8 q
// Enter the path to a model file! & [7 d' N% l7 N3 w
simple.LoadModel("C:\\Models\\Test.spp"); ; C6 ]. J" W8 Z" X: a6 F r
} : {4 a5 } K' Z5 D9 b; M" [
catch (e)
% j/ v# M9 O$ w% V{
+ i3 B0 T: M8 O9 [. a WScript.Echo("Could not load Model!");
# p2 V7 O) @! c7 ]( v WScript.Quit(); 7 ? Z5 b+ Y8 }3 b* r8 t
} . z' t8 s2 v; a# ~+ ^$ S# W6 t% F
( y& H7 ?1 ^* ^7 h( v1 \! Ftry
9 b# q) Z+ ?% I! {{
' ^ j, G2 \& s! ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 S# G. O! x6 K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 _/ z* p$ q' j8 q8 o/ G3 B. D if (r == vbCancel)
8 \7 W! p( L% L" Z$ ~ {
( ]% M8 O/ Y$ j% S simple.CloseModel();
( Y9 p2 d( i& \# p8 P* |7 } WScript.Quit(); / h& a& i$ v9 }. R
}
$ N1 s3 ~8 L* a) R- B C} 2 A L9 ^' f( {5 {6 N
9 j3 k8 j. H X( e2 t. |/ Msimple.StartSimulation(".Models.Frame.EventController"); " K: @+ _: c9 {9 a1 p7 K3 l/ v
) [# I& ~7 R" t1 c6 t, Q
if (simple.IsSimulationRunning()) $ Q+ H) ] a1 p$ W
WScript.Echo("Simulation is running!"); 0 ^/ F9 ?% O v; G5 R4 B. ^
' f/ ~1 B# w6 u w# n// Wait until simulation is finished . f+ F8 U# F9 P5 \( e; g7 p% I
while (!Finished) WScript.Sleep(2000);
' E, J- c& \. H) I
% q! E# C8 n. w9 G/ i4 e5 Rsimple.CloseModel(); : R, H4 I a1 v7 t4 U3 K
simple.Quit();
$ i" f J4 D! j7 d3 q% Y5 I+ q5 MWScript.Quit();
6 B q7 j' P) ^& B . [9 k* U$ [/ V2 T' M
) H* o6 a3 R+ r. ?' y2 P0 kfunction RemoteControl_SimulationFinished() 8 [5 |/ P' }. w0 X; ~
{ & _0 L2 f/ A6 {7 {8 e% [
WScript.Echo("Simulation Finished!"); |