Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: WINDHAM on July 29, 2009, 12:44:18 PM

Title: How to stop garbage collection?
Post by: WINDHAM on July 29, 2009, 12:44:18 PM
Is there any way to preserve objects / variables in separate scripts contained within mach3 buttons after termination of the script? 

I've created an mscomm object in a button script to open a serial port, but it kills the object when the script terminates, requiring repetitive recreation of this object and repetitive opening/closing of the port as a result.

What is the typical method for sharing or preserving variable/object information between independant scripts?  Is it possible?
Title: Re: How to stop garbage collection?
Post by: Ron Ginger on July 29, 2009, 05:53:54 PM
Not possible. Each instance of a button is a one time, run and delete.

Ive spent several hours leaning on Brian to fix that. He is sympathetic to the issue, but he seems to find other things to keep him busy. Maybe someday he will get to this.
Title: Re: How to stop garbage collection?
Post by: vmax549 on July 30, 2009, 11:05:13 AM
Could you load the needed code to support the port into the macro pump, then preserve VARS into the Gcode Vars where you have access from all over???

Just a thought, (;-) TP
Title: Re: How to stop garbage collection?
Post by: poppabear on July 30, 2009, 11:38:53 AM
Perhaps you could build your com object as a standalone object (or thread?) Active X or what ever, then in a Plugin you can access that object, and from your buttons you can send various "NotifyPlugins()" codes to do different things to/from your object from the plugin depending on how bad you really want something like that.

scott