StrEdit(File,Line,New=0){ Loop,read,%File% Vsego := A_Index th2 :=Line-1 loop %th2% { FileReadLine,th3,%File%,%A_Index% if th4 != th4 := th4 "`n" th3 If th4 = th4 := th3 } if New != th4 := th4 "`n" New if New = th4 := th4 loop % Vsego - th2 - 1 { Line1 := Line + A_Index FileReadLine,th3,%File%,%Line1% th4 := th4 "`n" th3 } FileDelete,%File% FileAppend,%th4%,%File% return th4 }
Пример:
Код
StrEdit("test.txt","2","ss")
test.txt-файл 2-номер строчки ss-Это то на что мы меняем(Если оставить пустым строчка удалится) Файл сам "обновится" StringReplace не поможет так как если символы в нужной строке будут повторятся то отредактируются\удалятся те которые стоят первые(или в обще все ) МОЙ ВК - https://vk.com/gospodin_buero