Currently I am able read .csv files in AutoHotkey. But is there a straight forward way to replace or delete fields as well?
This is my code currently which just reads each field line by line. It would be great if I could write the current selected field, but seems like that's not possible. The only other way I can imagine approaching it is doing more complex stuff with the file object and seek/write methods, but then I would have to be counting the individual characters read, and how many characters in a line to get to the first character of the field I'm looking to change, etc. Seems like their could be more eloquent way to do this, any ideas? thank you!
Code: Select all
filePath := "C:\Desktop\mycsv.csv"
Loop Read filePath
{
MsgBox A_LoopReadLine
indexL := A_Index
Loop Parse, A_LoopReadLine, "CSV"
{
MsgBox "Index: " . indexL . "`n`n" . "Field: " . A_LoopField
if (indexL == 1 && A_index == 4) {
; A_LoopField := "banana" <--- it would be great if I can do something like this, but the loopfield vatriable can be written to it seems, only read
}
}
}