Each text file that is made will have a max of 98 lines of random text from the main file and also I want there to be no repeats.
I also want each new file name to be incremented (NewFile1, NewFile2, NewFile3, etc).
I am able to get the first text file made but there are repeats and I dont know how make the next files.
Here is my code so far any help will be appreciated :]
Code: Select all
#SingleInstance Force
Inc := 1
Guiw := 300
Guih := 80
GuiX := 2432
GuiY := 47
MainF := "C:\Users\" A_UserName "\OneDrive\Desktop\MainList.txt"
NewF := "C:\Users\" A_UserName "\OneDrive\Desktop\NewFile"
Loop, Read, % MainF
numlines := A_Index
Gui, +AlwaysOnTop +ToolWindow
Gui, Color, 0x202020, 0x333333
Gui, font, cFEFAF3
Gui, Add, Button, x5 y40 w60 gRunN, Run
Gui, Add, Button, x75 y40 w60 gRefreshH, Reload
Gui, Add, Button, x145 y40 w60 gNoteX, NoteX
Gui, Add, Button, x215 y40 w60 gDelL, Delete
Gui, Show, w%Guiw% h%Guih% x%GuiX% y%GuiY%
return
DelL:
Loop, %numlines%
{
FileDelete, % NewF Inc ".txt"
Inc++
}
Inc := 1
MsgBox,,,Deleted!,1
return
RunN:
Loop, %numlines%
{
Loop, Read, % NewF Inc ".txt"
numlinesS := A_Index
if (numLinesS < 98){
Random, randomNumber, 1, %numlines%
FileReadLine, TXTT, %MainF%, %randomNumber%
FileAppend, %TXTT%`n, % NewF Inc ".txt"
}else{
}
}
Reload
return
RefreshH:
Reload
return
NoteX:
Runwait, taskkill /im Notepad.exe /f
return
Gosub esc
esc::
GuiClose:
ExitApp