Solved

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

Posted on 1998-10-19
7
148 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses
Course of the Month6 days, 14 hours left to enroll

623 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