I create a file through File.WriteAllText How to make so that when opening a file the caret is at the end of the file?
|
1 answer
See, you can't make a notebook just go to the right position. He does not have this in the command line keys, and this is not in the text format either.
But you can emulate keystrokes on the keyboard, which will send the caret to the end of the file.
To do this, connect System.Windows.Forms, and do this:
File.WriteAllText(path, text); // запустить процесс var p = Process.Start("notepad.exe", path); // дождаться, пока он загрузит документ и начнёт реагировать на клавиатуру p.WaitForInputIdle(); // послать нажатие Ctrl-End System.Windows.Forms.SendKeys.SendWait("^{END}"); // дождаться, пока юзер закроет блокнот p.WaitForExit(); |
File.AppendText) - Alexey Sarovsky