troubleshooting Question

Open a Text Editor from the Command Line Programatically using C#

Avatar of Frank Bryant
Frank BryantFlag for United States of America asked on
Editors IDEs
3 Comments1 Solution257 ViewsLast Modified:
First let me say that I am a novice when it comes to C#; I am using Visual Studio Enterprise 2015.

I am trying to run a Macro from a Text Editor (Ultraedit) using the Command Line Shell in C# programmatically and I have not been successful.

Here is the text editor Command Line ... uedit32 /fni DriveLetter:\Path\TextFileName.txt /m="DriveLetter:\Path\MacroName.mac" ... I know it works as I ran it from a (Start --> Run) Command Window to test it.

Anyway, here is the problem that I am trying to solve; I have a VERY Large text file which has errors that have to be resolved before it can be imported. This one file is to large to run macros on (out of memory error),  so I have an ultraedit script that takes this very large text file and splits it into several smaller files at 175,000 rows each. I currently have 28 smaller files and four macros to run; 4 x 28 = 112 iterations. I want to automate this process; can it be done?

For what it is worth, here is the C# Code that I am using ...

            // There are 28 Separate Text Files each with 175,000 Data Rows to Be Modified ...
            for (int TheTextFileToBeRead_Loop = 1; TheTextFileToBeRead_Loop <= 28; TheTextFileToBeRead_Loop++)
            {
                for (int TheMacroToBeExecuted_Loop = 0; TheMacroToBeExecuted_Loop <= 3; TheMacroToBeExecuted_Loop++)
                {
                    CmdLineToExecute = @"uedit32 /fni DriveLetter:\Path\TextFileName" + TheTextFileToBeRead_Loop  + ".txt /m=" + (char)34 + @"DriveLetter:\Path\MacroName" + TheMacroToBeExecuted_Loop + ".mac" + (char)34;
                    System.Diagnostics.Process.Start("CMD.exe", CmdLineToExecute);
                }
            }
ASKER CERTIFIED SOLUTION
AndyAinscow
Freelance programmer / Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros