You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a beginner to Autohotkey and I though this library would help me complete what I wanted to do. Currently, I am just reading in a tsv file (tab separated value file). The file seams to load. When I output the headers, the message box is missing the last column.
Script Source Code
#include csv.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
csv_filename := "timecard2.txt"
FormatTime, CurrentYear,, yyyy
FormatTime, CurrentMonthDay,, MM-dd
FormatTime, CurrentWeekday,, ddd
FormatTime, CurrentTime,, hh:mm
Week := SubStr(A_YWeek, -1)
CSV_Load(csv_filename,CSV,"`t")
row := CSV_ReadRow(CSV,1)
Msgbox %row%
In this case it is due to the fact the last line in the TSV only has two columns, so after 07:07 on row 6 there is no tab character, so the file is assumed to have two columns. If you add a tab character or tab+value it would work:
So you should either ensure that the source of the data (program with export function I assume) writes all cells and thus columns (even if empty) or perform a check prior to reading the data and "append" a missing cell in the last row. Note that if it had been any other row -- you can test this by removing the tab + cell from row 2 for example -- it wouldn't have caused an issue. Only because it happens to be the last row you now notice it. (I didn't write the library although I did contribute to it at the time - and as I'm using it in production and I assume others too I'm hesitant to post updates to fix such things)
Syntax tip: the "name" of the identifier (you use CSV) should be quoted, so "CSV" unless you use CSV as a variable like you have done with csv_filename
I am a beginner to Autohotkey and I though this library would help me complete what I wanted to do. Currently, I am just reading in a tsv file (tab separated value file). The file seams to load. When I output the headers, the message box is missing the last column.
Script Source Code
Data file
Files
time_punch - Copy.txt
timecard2.txt
The text was updated successfully, but these errors were encountered: