Frank Bryant
asked on
Open a Text Editor from the Command Line Programatically using C#
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\TextFile Name.txt /m="DriveLetter:\Path\Macr oName.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\TextFile Name" + TheTextFileToBeRead_Loop + ".txt /m=" + (char)34 + @"DriveLetter:\Path\MacroN ame" + TheMacroToBeExecuted_Loop + ".mac" + (char)34;
System.Diagnostics.Process .Start("CM D.exe", CmdLineToExecute);
}
}
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\TextFile
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\TextFile
System.Diagnostics.Process
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is the correct code ...
CmdLineToExecute = @"C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit3 2.exe"
TheArgumentsToPassAre = " /fni DriveLetter:\Path\TextFile Name" + TheTextFileToBeRead_Loop + ".txt /m,e=" + (char)34 + @"DriveLetter:\Path\MacroN ame" + TheMacroToBeExecuted_Loop + ".mac" + (char)34;
System.Diagnostics.Process .Start(The CommandLin eToExecute Is, TheArgumentsToPassAre);
CmdLineToExecute = @"C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\Uedit3
TheArgumentsToPassAre = " /fni DriveLetter:\Path\TextFile
System.Diagnostics.Process
ASKER