Solved

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

Posted on 1998-10-19
7
142 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

17 Experts available now in Live!

Get 1:1 Help Now