Source language: Translate to:

Using an object (CreateObject) created in a vbs function

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Using an object (CreateObject) created in a vbs function

Postby cp4w » Thu Feb 12, 2009 10:47 am

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
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby Neosoft Support » Thu Feb 12, 2009 11:11 am

No it won't work. When a VBScript terminates any objects it creates are automatically deleted.
Last edited by Neosoft Support on Fri Feb 13, 2009 11:36 am, edited 1 time in total.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Gaev » Thu Feb 12, 2009 11:19 am

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".
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby cp4w » Thu Feb 12, 2009 12:52 pm

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
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby Neosoft Support » Fri Feb 13, 2009 11:43 am

...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.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby dpayer » Fri Feb 13, 2009 5:49 pm

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
User avatar
dpayer
 
Posts: 1383
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby cp4w » Sat Feb 14, 2009 5:40 pm

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.
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests