Jump to content
Macro Express Forums

Wait in Visual Basic .Net for macro to end


rberq

Recommended Posts

From Visual Studio .NET I use Process.Start, to start either meproc.exe or macexp.exe, passing it the name of a macro. This is working just fine -- the macro runs with either program. However, I want my Visual Studio program to wait for completion of the macro.

 

I can get the names of processes running on the PC with Process.GetProcessesByName, and I can Process.WaitForExit to know that a process has exited. However, it does no good to wait for meproc.exe to finish, because that program only tells macexp.exe to run the macro and then ends before the macro runs. Likewise it does no good to wait for macexp.exe to exit, because it seems to exit at random times that have nothing to do with whether my specific macro has finished or not.

 

Suggestions, anyone?

Link to comment
Share on other sites

What I have done in those situations is have the calling program write to the registry and have the macro delete the registry. If you look at the sample macro installed with SpeakIt - Text to Speech add on program you can see what I mean.

 

You could just as easily have your Visual Basic.Net program write to a file and have the macro delete the file. Either way, your Visual Basic.Net program needs a loop that waits and checks for the registry value or file to be deleted.

Link to comment
Share on other sites

What I have done in those situations is have the calling program write to the registry and have the macro delete the registry. If you look at the sample macro installed with SpeakIt - Text to Speech add on program you can see what I mean.

 

You could just as easily have your Visual Basic.Net program write to a file and have the macro delete the file. Either way, your Visual Basic.Net program needs a loop that waits and checks for the registry value or file to be deleted.

 

 

Thanks to both of you. I used the write-a-file method just because I'm more used to that than to playing with the registry.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...