Creating a Process and passing in a string?


Hello,

I am trying to use our 3rd party fax software FaxPress. It requires this line of text to be called during a command line.

Our old VB 6 app is doing this but using a shell command. I was told this could be done using the Process class in C#.

Here is what I have:

/// <summary>
/// Faxes attachments to destination
/// </summary>
/// <param name="output">Output directory for FaxPress</param>
/// <param name="subject">Subject Line</param>
/// <param name="faxPress">Fax system to use. TACCFAX1*</param>
/// <param name="account">Login account. XOC</param>
/// <param name="files">Attachments /A</param>
/// <param name="phone">Calling info [name @][company @] PhoneNumber</param>
private void GenerateFax(string output, string subject, string faxPress, string account, string files, string phone)
{
StringBuilder executeString = new StringBuilder();
executeString.Append("SubmitFax /S " + faxPress);
executeString.Append(" /U " + account);
executeString.Append(" /R " + phone);
executeString.Append(" /O " + output);
executeString.Append(" /B " + subject + " ");
executeString.Append(files);
executeString.Append(" " + "/C NO COVER PAGE");

Process process = new Process();
process.StartInfo.Arguments = executeString.ToString();
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
}

Does this look right Is process.StartInfo.Arguments the right property There is no batch file or .exe to be called, just this string.

Thanks for any help!

Chris


Answer this question

Creating a Process and passing in a string?

  • dom_tiger_99

    Not sure really since I've never used any thing with Process before. Here is what the documentation says on it for VB:

    The following example demonstrates how to launch SubmitFax from Visual Basic use:

    excstr$ = "SubmitFax /s” + MyFaxPress + “/u” MyAccount + “/p” + MyPassword + “/c” + MyCoverPage + “/m” + MyMessage + “/a” MyFile1.doc

    Shell (excstr$)




  • Tycotrix

    i.e.

    process.StartInfo.FileName


  • loosie

    Greg,

    I've done as you suggested, however I am receiving this error now:

    The instruction at ")x73dd442d" referenced memory at "0x00c99805". The memory could not be "read"

    Any ideas

    Thanks,

    Chris

  • qwerty51015

    The shouldn't that be the target of execution
  • SalamELIAS

    Thanks for the reply.

    Yes that's correct.

  • mokeefe

    try using a full path to it ..

    remember you have to remove it from the arguments as well ...

    Cheers,

    Greg


  • Rob Cannon

    I tried using SubmitFax in the filename property but it didn't work.

  • Carolyn Chau

    is SubmitFax not whats being executed
  • Creating a Process and passing in a string?