[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Passing Values back to VBScript from a VB Executable

Posted on 2005-05-13
3
Medium Priority
?
841 Views
Last Modified: 2011-10-03
I need to run a vbscript that will launch an executable VB Program.  I have to use a vbscript to launch the executable (that I wrote) so I can have it return however I want.  This program needs to pass a set of 30 values back to the vbscript, preferably in an array but I can use a long string and split it.

How can I use vbscript to read the value stored in the ExitProcess() function and will it hold all my information?  Can I share a property bag from the EXE program back to the vbscript?  Is there a better way?  I'd like to avoid writing out to a text file or registry if possible.

Thanks.
0
Comment
Question by:skimmel
3 Comments
 
LVL 1

Expert Comment

by:miswmf
ID: 13997753
Could you close the vbscript app when you launch the vb program, then from the vb program run the vbscript app with your 30 variables as command line parameters?  You could also send a piece of info to tell the script app where to go to use the command line parameters.
0
 

Author Comment

by:skimmel
ID: 13997844
No.  The VBScript is launched from a different application that I don't control.  It will pass a piece of information to the Executable via a command line switch.  Once I get the data back from the Executable, I need to run the rest of the code in VBScript (the only thing the controlling application can understand).  Thus the process goes:

Contolling Application Launches vbscript
     VBScript gets information from the Controlling App
     VBScript launches the Executable passing the information in the command line (currently wshell, but I'm open to change)
     VBScript stays open
          Executable runs code and determines data to pass back
          Executable Closes
     VBScript reads data from executable and performs more API actions with Controlling App
     VBScript Closes
Controlling App returns to other processing

I hope that makes sense.
0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 1500 total points
ID: 14004188
As far as i know, the exit code is only a long value..
Private Declare Sub ExitProcess Lib "kernel32"  (ByVal uExitCode As Long)          'MSDN


so perhaps the only way to pass variables back is a text or binary file :-<    (though it works perfectly well for me)
binary is good for writing an array or userdefined type.  ie keep all the data to be swapped between apps in a Type.
makes it easy to write data file & to keep definitions in sync. (though VBS doesnt support it, u can at least paste the type def in as a comment)

if you expected to have multiple processes running, you could use exitcode as a filename...

 
   uExitCode=timer        'secs since midnight
  outputfile="VBApp" & format("0000000000",uExitcode)

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month18 days, 5 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question