Tuesday, December 23, 2008

AHK - GenFile() - Generate files with exact size in bytes

This simple function will append exactly %Bytes% bytes to %Name%. This is useful for testing things that need to be able to move files, you can test for files of average size and get an accurate speed test.
GenFile(Name, Bytes) {
VarSetCapacity(FBytes, Bytes, 1)
FileAppend, % FBytes, % Name

GenFile("File.txt", 1024) ; Generates a 1kb file named "File.txt"

No comments: