Solved

Interfacing VB With PERL???

Posted on 1998-11-26
6
242 Views
Last Modified: 2010-05-03
OK, THis should be a sinch form any real VB or Perl Guru but it has had me stumped for some time... Hope you can help

I need to be able to pass values from an executable perl script to a VB Application...Sound easy.
I ahve managed to work around this by using an intermediate file but this  is cumbersome and inneficient...THERE MUST BE A BETTER WAY!!

I do not need to send commands or information to the perl script but the script must be able to returna value to VB ...

Hope you can help, Thanx in advance

Wayne Lee-Archer
Managing Director
Everything Multimedia Australia P/L
ema@microtech.com.au
0
Comment
Question by:Flubbadub
  • 3
  • 3
6 Comments
 
LVL 2

Expert Comment

by:hobster
Comment Utility
use the Command function
0
 
LVL 3

Author Comment

by:Flubbadub
Comment Utility
?????......Please elaborate, are we talking from the Perl end of the deal or The VB end of the deal, i need to be able to send info back from perl to VB...


W. *confused*
0
 
LVL 2

Expert Comment

by:hobster
Comment Utility
i actually create a vb program that was called from a perl script. So, from Perl, the user would type something:
ole test.gif test2.gif
where ole is the vb executable. This would start up the vb program which requires 2 file parameters. Below is a part of the vb code that processes these parameters.

Dim filename As String
Dim Action As Object
     
'number of max parameters
Dim param(2) As String
   
'the current parameter number you're on
Dim paramCounter As Integer
   
'the number of times run through a loop
Dim loopCounter As Integer
   
'the character the loop is looking at
Dim currentCharacter As String
Dim parameters As String
Dim ReturnValue As Variant
Dim I As Variant
Dim strText As String
Dim strCurrentPath As String
Dim strFullPath As String
Dim strFile As String * 2
         
parameters = Command()
 
strCurrentPath = CurDir
 
paramCounter = 1

For loopCounter = 1 To Len(parameters)
      currentCharacter = Mid$(parameters, loopCounter, 1)
      If currentCharacter = " " Then  'break between parameters
         paramCounter = paramCounter + 1   'start reading a new parameter
      Else
         param(paramCounter) = param(paramCounter) & currentCharacter
      End If
Next loopCounter
         
strFile = param(1)
   
For loopCounter = 1 To Len(strFile)
      currentCharacter = Mid$(parameters, loopCounter, 1)
     
     If currentCharacter = ":" Then
         strFullPath = param(1)
         
      ElseIf currentCharacter = "\" Then
         strFullPath = strCurrentPath & param(1)
     
      Else
     
         strFullPath = strCurrentPath & "\" & param(1)
         
      End If
   Next loopCounter

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Author Comment

by:Flubbadub
Comment Utility
*VBG*

Very Close.....I will give you the points anyway (submit next response as an answer) but from what I can see here, the Perl script must call the VB App.  I need the VB app to call the Perl script and get some feedback from it....does or will this method work that way too???

*happy* W.
0
 
LVL 2

Accepted Solution

by:
hobster earned 100 total points
Comment Utility
With the method I just gave you, you can only call the vb program from perl. That program will also take any parameters that perl sends out.

To get the vb program to call the perl script, you need something like this:

RetVal = Shell("perl.exe C:\script.pl [param1] [param2], 1)

Note that the above code is also sending some parameters to the perl script. Good luck!
0
 
LVL 3

Author Comment

by:Flubbadub
Comment Utility
*Sobs*

Looks like I am asking a bit too much.. you have helped greatly and probly saved me a lot of time and $$......to implement the project using your answer i would have to split the VB app into multiple little exe's an that is just YUKKKY!.....so much for interaction between languages! :-(
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now