Solved

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

Posted on 1998-10-19
7
143 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

11 Experts available now in Live!

Get 1:1 Help Now