rberq Posted May 16, 2008 Report Share Posted May 16, 2008 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? Quote Link to comment Share on other sites More sharing options...
paul Posted May 16, 2008 Report Share Posted May 16, 2008 Your macro should signal it has finished by doing something your .net program can detect, e.g. write a value to the registry, create a file, delete a file, etc. Quote Link to comment Share on other sites More sharing options...
kevin Posted May 16, 2008 Report Share Posted May 16, 2008 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. Quote Link to comment Share on other sites More sharing options...
rberq Posted May 16, 2008 Author Report Share Posted May 16, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.