Labyrinth script does not shut down Excel.

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Labyrinth script does not shut down Excel. // Archive: Tech Forum

1  |  

Post by trueBlue // Sep 30, 2006, 3:01pm

trueBlue
Total Posts: 1761
pic
Any ideas on what would be the correct way to shut down Excel when running the Labyrinth script? Quit, Close, Exit, and or Die does not work.

// load labyrinth matrix
for (x = 1; x <= width; x++)
{
for (y = 4; y <= height+4; y++)
{
if (ExcelApp.ActiveSheet.Cells(y, x).Value)
{
// create "wall" here
name = Space.Cube(cubeSize,cubeSize,cubeSize,1, 1, 1);
// set position
Node.Value(name,'tx') = x;
Node.Value(name,'ty') = y;
Node.Value(name,'tz') = 1.0;
}
}
}
ExcelApp.Quit();
}

Post by frootee // Sep 30, 2006, 3:52pm

frootee
Total Posts: 2667
pic
Hey TrueBlue. You may have to call upon the Windows Lord High Executioner aka the Process Killer. Not sure how you could do this, but from the task manager, you select the process, and select End Task.


So you may have to delve into Windows programming, and use the command that returns the process id that you are looking for. This command will most likely return a pointer to a structure, or a Windows message which contains the stuff you want. Then, you would have to call another Windows command to end the process. Something like this:


psid = Windows_System_Command_Get_Process_ID(Active_Excel _Spreadsheet)

Windows_Parse_Message_to_Get_PSID(psid)

Windows_System_Command_End_Process(psid)


I hope that helps, although it may appear vague. I have not dived into Windows programming too much but I have a bit of an idea as to what it looks like.


Later TrueBlue!


Frootee

Post by Norm // Sep 30, 2006, 6:20pm

Norm
Total Posts: 862
pic
Jscript has a funky way of handling garbage collection.

Paul and I were exploring this last week, which is where I believe this is stemming from. I actually recreated a script in vbscript that shuts down excel. In vbscript, the "quit()" command works instantaneously. In jscript, my research led me to believe that there was a time interval required from when you are finished with excel and the quit() command is sent. Some method to delay for say 15ms or so and then quit the excel in code.


Is not really a trueSpace bug or such, just nature of the jscript beast.

Post by trueBlue // Sep 30, 2006, 7:35pm

trueBlue
Total Posts: 1761
pic
Anyway before I discovered that the Labyrinth jScript was not shuting down Excel, I was having fun building a two story house with 2x4 studs, 2x6 joist, and flooring with this script.
While I was trying different methods to shut down Excel, and there was many. I discovered a message that was lurking in the background. But this was after I used the Task Manager to shut down several running Excel.exe, so I am not sure which one of my methods created the message. See image below. I was not implying that this was a trueSpace bug, but trying to fix the script.
So you are saying, I should recreate the above script in VBScript? Could you point me in the right direction how I could change the Size values in the
name = Space.Cube(cubeSize,cubeSize,cubeSize,1, 1, 1); from an Edit control?

Post by frootee // Oct 1, 2006, 3:52am

frootee
Total Posts: 2667
pic
or perhaps use a timer in your jscript to wait 15 msec or so, as Norm indicates, before sending the quit message once you are done with excel.

Post by Norm // Oct 1, 2006, 4:06am

Norm
Total Posts: 862
pic
Anyway before I discovered that the Labyrinth jScript was not shuting down Excel, I was having fun building a two story house with 2x4 studs, 2x6 joist, and flooring with this script.

While I was trying different methods to shut down Excel, and there was many. I discovered a message that was lurking in the background. But this was after I used the Task Manager to shut down several running Excel.exe, so I am not sure which one of my methods created the message. See image below. I was not implying that this was a trueSpace bug, but trying to fix the script.

So you are saying, I should recreate the above script in VBScript? Could you point me in the right direction how I could change the Size values in the

name = Space.Cube(cubeSize,cubeSize,cubeSize,1, 1, 1); from an Edit control?


Question is, where did that codeline get its value for cubeSize? It is a variable up at very top end of script. If you check out the cube that gets created, you see it has 6 connectors: Cx, Cy, Cz, Resolution Cx, Resolution Cy and Resolution Cz.


Space.Cube(Cx, Cy, Cz, Res Cx, Res Cy, Res Cz) is how the values line up.


Hope is helpful.

Post by trueBlue // Oct 1, 2006, 2:39pm

trueBlue
Total Posts: 1761
pic
Thanks Frootee and Norm.
I believe I found a way but I am not sure how to write it.
WScript.Sleep(500)
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn