Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

calling a process (external) in a loop

Posted on 2009-07-14
4
Medium Priority
?
165 Views
Last Modified: 2013-12-17
Hello group,

I've started writing a code in C# and there is a step that I have to read a directory full of PDF and convert them to Text (using an open source). In fact, I am calling a process within a loop.

I'm worry that would cause issue sometimes or ... any idea or advice will be appreciated.

Regards,

in the loop:
 
{
                    Process p = new Process();
 
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardInput = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.FileName = "C:\\test\\pdftotext.exe";
                    p.StartInfo.Arguments =  strPDFIn + " " + strTestOut;
                    p.Start();
 
  }

Open in new window

0
Comment
Question by:akohan
[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
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24859585
What kind of "advice" do you need?  What kind of problems do you foresee?  Do you need to wait for the process to complete before moving on to the next process?  Does each process work on its own .pdf file and output?
0
 

Author Comment

by:akohan
ID: 25170969


Yes, I need to know how I can make it wait to process 1 gets complete.

Regards,
ak
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 25172659
You can use something like this:

p.WaitForExit();

    -- or --

p.WaitForExit(10000);    // Timeout after 10 seconds.
0
 

Author Comment

by:akohan
ID: 25173792


Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 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