2

I have a VB6 code and another VBScript which runs in the background. I need to pass a variable periodically (say, with a timer) from VB6 code to the background VBscript. Is there any way other than write down to temporary file and read it from VBscript?

Tuncay, Thanks...

10
  • You can use command line arguments while calling vbs file. technet.microsoft.com/en-gb/library/ee156618.aspx Commented Jan 2, 2018 at 13:12
  • Right. But my VBscript will work once and do some background processes. During this period, I need to pass a value continuously to running vbscript. Commented Jan 2, 2018 at 13:28
  • 1
    In that case, using a file is a good option. The other options that you can use are using clipboard or a database. Commented Jan 2, 2018 at 13:38
  • You can use custom environment variable as well if you are just using a variable's data. I am not sure how do you work with EVs in VB6 but its easy to implement in VB.NET. Commented Jan 2, 2018 at 14:08
  • 1
    Windows® Script Components provide you with an easy way to create powerful, reusable COM components in script. You create script components using any scripting language that supports the Microsoft® ActiveX® Scripting interfaces. Script languages that support these interfaces include JScript, Microsoft® Visual Basic® Scripting Edition (VBScript), PERLScript, PScript, and Python. msdn.microsoft.com/en-us/library/aa233148(v=vs.60).asp Commented Jan 2, 2018 at 23:16

1 Answer 1

1

You should look into Message Queues, which are accessible from both VB6 and VBS. They're designed for this purpose. If the following link rots, search for VBS and MSMQ. Another possibility is named (or anonymous) pipes as described in a previous SO post.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks but currently it is hard to understand for me. I will try it.
The sample from the link bombs w/ ActiveX component can't create object: 'MSMQ.MSMQQueueInfo'. You don't suggest to install Message Queuing Server just to pass a string from VBScript?
@wqw - MSMQ is a stock (but optional) Windows component. It's easy to include it if it's not in your current setup, but you're right that not everyone will want to. In that case pipes are just as effective and guaranteed to be available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.