Page 1 of 1

Using an object (CreateObject) created in a vbs function

PostPosted: Thu Feb 12, 2009 10:47 am
by cp4w
Hi,


I am executing a vbscript function where a com object is created in one vbs function call and in the same app I would like to access that com object with a different vbs function call.

It doesn't seem to work.

Am I missing something?

Steven

PostPosted: Thu Feb 12, 2009 11:11 am
by Neosoft Support
No it won't work. When a VBScript terminates any objects it creates are automatically deleted.

PostPosted: Thu Feb 12, 2009 11:19 am
by Gaev
Steven:

I don't believe you can do this directly ... each time you invoke a NeoBook Function, it is serviced in its own "space" (i.e. a separate instance) ... so variables are local to the space/instance.

I haven't tried this ... but you might be able to create a "pseudo client-server" environment by ...

- having a NeoBook (vbscript/javascript) Function "create the space/instance
- in the vbscript, you create the COM object
- then go into a "conditional loop"
---> sleep for a 300 msec
---> check NeoBook variables for "task requests"
---> perform any requests tasks ... via calls to other vbscript/javascript functions defined in the same NeoBook Function

One of the "requested tasks" would be "Please Quit Looping Now"


Perhaps advisable to try this out with a simple structure first ... i.e. have a NeoBook ListBox populate a NeoBook Variable ... which would be the one queried every 300 msec from the looping vbscript ... which in turn would just populate another NeoBook variable ... which was echoed in a NeoBook TextBox ... if that works, you can design/build your own client-server protocol for requesting/responding to "tasks".

PostPosted: Thu Feb 12, 2009 12:52 pm
by cp4w
Thanks for the quick answers.

It is disappointing that there is no straight forward way to accomplish this.

Gaev, I appreciate your suggestion but I am not looking for a work around

Steven

PostPosted: Fri Feb 13, 2009 11:43 am
by Neosoft Support
...I am not looking for a work around.


This is akin to eating a sausage and not wanting to hear about the gruesome process involved in creating one. As a programmer who works in the sausage factory that is Windows, my job would be all but impossible if I wasn't able to employ workarounds for the many bugs, deficiencies, etc. in Windows.

PostPosted: Fri Feb 13, 2009 5:49 pm
by dpayer
Neosoft Support wrote: As a programmer who works in the sausage factory that is Windows, my job would be all but impossible if I wasn't able to employ workarounds for the many bugs, deficiencies, etc. in Windows.


I see a new version coming:

NeoSausage 6.0

"it tastes good..... don't ask questions!"

:lol:

David P

PostPosted: Sat Feb 14, 2009 5:40 pm
by cp4w
This is akin to eating a sausage and not wanting to hear about the gruesome process involved in creating one. As a programmer who works in the sausage factory that is Windows, my job would be all but impossible if I wasn't able to employ workarounds for the many bugs, deficiencies, etc. in Windows.


I meant that there was a different method that I would use. Namely nzScript plug-in by Chauvin that lets me do this.