#SingleInstance force #NoEnv Header=9 FileRead, wiki, wiki.txt Loop, Parse, wiki, `n, `r lines := A_Index Loop, Parse, wiki, `n, `r { StringLeft, Char1, A_LoopField, 1 If Char1 != [ { If (A_Index <= Header) { FileAppend, %A_LoopField%`r`n, NewWiki.txt continue } If (Char1) AND (Char1 != "=") { pos := A_Index - 1 comment%pos% := "`r`n" A_LoopField continue } If (A_Index = lines) Stop = 1 Else If !(Char1) continue Sort, category Loop, Parse, category, `n, `r { If !(A_LoopField) AND (Stop) ExitApp num := InStr(A_LoopField,A_Space,"",0) num := StrLen(A_LoopField) - num StringRight, pos, A_LoopField, %num% StringTrimRight, end, A_LoopField,% num+1 FileAppend,% beg%pos% end comment%pos% "`r`n`r`n", NewWiki.txt } FileAppend, %A_LoopField%`r`n`r`n`r`n, NewWiki.txt category= continue } URL := InStr(A_LoopField,A_Space) StringLeft, beg%A_Index%, A_LoopField, %URL% StringTrimLeft, end, A_LoopField, %URL% end := RegExReplace(end,"^\s+") category .= end A_Space A_Index "`r`n" }