• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Interfacing VB With PERL???

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
Flubbadub
Asked:
Flubbadub
  • 3
  • 3
1 Solution
 
hobsterCommented:
use the Command function
0
 
FlubbadubAuthor Commented:
?????......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
 
hobsterCommented:
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
FlubbadubAuthor Commented:
*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
 
hobsterCommented:
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
 
FlubbadubAuthor Commented:
*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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now