Solved

Think you're an expert? Answer this!!!

Posted on 1998-10-19
7
144 Views
Last Modified: 2010-08-05
Here's a hard question for all you experts.

I've got a vb program that calls a Perl script. The Perl script will then convert a group of SGML files to HTML files. If there are any errors during the conversion, the error messages will be put into a text file. The vb program will then check that text file and if it has error messages, those messages will appear in a textbox within the vb program.

The problem has to do with WHEN the vb program checks the text file. What happens is that the vb program calls the Perl script, the Perl script forks (creates) another process which does the actual conversion.

My vb program doesn't know this. As a result, it checks the text file before the conversion finishes, so any error messages during the current conversion will not be displayed inside the vb program.

Below is a part of the code I'm talking about:

   'run the process.pl perl script
   RetVal = Shell("perl.exe C:\temp\process.pl D:\folder, 1)
   
   'function that displays error messages into textbox
   ShowErrorMessages

...so does anyone know how to fix this? How do I make it so the vb program knows when the actual conversion is finished and doesn't print the error messages too soon. Thanks.
0
Comment
Question by:hobster
7 Comments
 

Expert Comment

by:DJLawlor
ID: 1440683
Right!  For 5 points?

Look, a Hard question worth 200 Points!!!!


0
 
LVL 2

Expert Comment

by:WDB
ID: 1440684
Don't hold your breath for 5 freaking points!!
0
 
LVL 2

Author Comment

by:hobster
ID: 1440685
Sorry, I ran out of points.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 3

Accepted Solution

by:
TheAnswerMan earned 0 total points
ID: 1440686
why dont you just use an INI File that has a status.. then you can do somthing like this

Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Function gfn_GetINIString(ByVal as_Group As String, ByVal as_Item As String, ByVal as_Default As String, as_INIFilePath As String) As String
 Dim ls_Temp As String
 Dim li_ReturnCode As Integer
 Dim lengthOfTemp As Long
 ls_Temp = String$(2048, 32)
 lengthOfTemp = Len(ls_Temp)
 li_ReturnCode = GetPrivateProfileString(as_Group, as_Item, as_Default, ls_Temp, lengthOfTemp, as_INIFilePath)
 gfn_GetINIString = Mid$(ls_Temp, 1, li_ReturnCode) & ""
   
End Function


and have a timer.. that checks it something like this.
assuming timer interval of one second.
this will check the file for one minute. then call your procedure to continue.. if it takes longer than a minute.. then maybe an error occurred>  you


Private Sub Timer1_Timer()
if len(gfn_GetINIString("DBConnection", "EagleDBConn", "", App.Path & "\" & App.Title & ".ini")) > 0 then
  Timer1.Enabled = false
else
    TimerCount = TimerCount + 1
    if timerCount > 60 then
       if vbyes = msgbox("It is taking a long time do you want to wait?) then
          timerCount = 0   'count for another minute
       else
          Call DefectiveRoutine
       end if
    end if
end if
End Sub


0
 

Expert Comment

by:zuf
ID: 1440687
You can launch your application using the ShellProcess API call and poll the list of running processes to see if it's finished.....
0
 
LVL 2

Author Comment

by:hobster
ID: 1440688
Not exactly the answer I was looking for since the user has to wait in 60 secs interval. But I'll give you the points.
0
 
LVL 1

Expert Comment

by:vbyuval
ID: 4253182
nice to know things
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 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…

803 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