Skip to content

Commit

Permalink
Tags for Updates now work #26
Browse files Browse the repository at this point in the history
The selected tag(s) are saved in the Update file although they can't be accesed yet because there is no tag screen #24
  • Loading branch information
BlakCake committed Oct 4, 2019
1 parent 90cb0a2 commit e2dcec3
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 3 deletions.
47 changes: 44 additions & 3 deletions ProgressTracker.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Codename=ProgressTracker
CurrentUser=%A_UserName% ;Placeholder for collaboration in the future
Temp_File=0 ; Check to see if the current file is a temp file
SaveLocation=%A_MyDocuments%\ProgressTracker\ProgramData ; Default save location
TagFilePath=%A_MyDocuments%\ProgressTracker\ProgramData\Tags.ptl ; Default location of tag list file, this could be changed to a variable so the user can have multiple tag lists or load one from another user
FormatTime, LocalTime,,ShortDate
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
Expand Down Expand Up @@ -485,17 +486,51 @@ return
TagsButton:
gui, TagSelector:New, ToolWindow, Tag Selector
gui, Add, Text,, Select the tag(s) for this update:
gui, Add, ListView, w150 r10, Tags
Gui, Font, s11
gui, Add, ListView, AltSubmit gSelectTagListView Checked w150 r8, Tag Name
Gui, Font
gui, Add, Button, w25 gAddTag, +
gui, Add, Button, Default x35 y229 w125 gSaveSelectedTags, OK
gui, Add, Button, Default x35 y219 w125 gSaveSelectedTags, OK
LoadTags(TagFilePath)
gui, Show
Return

SelectTagListView:
;if A_GuiEvent = I
;{
; FileAppend, A_EventInfo, %A_Temp%\ProgressTracker\tags.temp
;}
return

AddTag:
Return

SaveSelectedTags:
gui, Submit, NoHide
gui, Submit
RowAmount := LV_GetCount()
RowNumber := 0
FileDelete, %A_Temp%\ProgressTracker\stags.temp
Loop,
{
FileRead, Stags, %A_Temp%\ProgressTracker\stags.temp
RowNumber := LV_GetNext(RowNumber, "C")
if ! RowNumber
{
break
}
Row := RowNumber
;MsgBox %Row%
LV_GetText(RowText, Row)
;MsgBox %RowText%
if Stags =
{
FileAppend, %RowText%, %A_Temp%\ProgressTracker\stags.temp
}
else
{
FileAppend, |%RowText%, %A_Temp%\ProgressTracker\stags.temp
}
}
Return

SaveUpdate:
Expand Down Expand Up @@ -536,12 +571,18 @@ TotalProgress := CurrentProgress + ProgressAddPercent
;MsgBox, %CurrentProgress% %ProgressAddPercent% %TotalProgress%
IniWrite, %TotalProgress%, %CurrentSaveFile%, %TVItemParentName%, ProgressTracker%TaskNumber%
FileCreateDir, %A_MyDocuments%\ProgressTracker\ProgramData\%SavedProgramName%\Updates\%TVItemName%
FileRead, UpdateTags, %A_Temp%\ProgressTracker\stags.temp
Loop, Parse, UpdateTags, |
{
AddToTagDir(A_LoopField,TVItemName,UpdateTitle,TagFilePath,1)
}
WriteUpdate(UpdateTitle,UpdateDescription,UpdateTags,FullUpdateFile)
Sleep 250
RefreshUpdateList(TVItemName,SavedProgramName,TVItemParentName,CurrentSaveFile)
IniWrite, %LocalTime%, %CurrentSaveFile%, %TVItemParentName%, LastChange
TV_Modify(TVItemID, Select)
GuiControl,,ProgressBar, %TotalProgress%
FileDelete, %RowText%, %A_Temp%\ProgressTracker\stags.temp
return

NotesListBox:
Expand Down
70 changes: 70 additions & 0 deletions TrackerFunctions.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,74 @@ RefreshUpdateList(Selected,SavedProgramName,ParentName,SaveFile)
LV_Add("",UpdateListTitle,UpdateListPercentage,UpdateListTime,UpdateListConvertedTime,UpdateListUpdateFile)
LV_ModifyCol(3, "SortDesc")
}
}

LoadTags(TagFile)
{
IniRead, TagList, %TagFile%, TagInfo, Tags
Loop, Parse, TagList, `|
{
TaskAmount = %A_Index%
LV_Add("-Check",A_LoopField)
}
}

AddToTagDir(TagToAdd,ParentName,ItemName,TagFile,TagHolder)
{
IniRead, TagList, %TagFile%, TagInfo, Tags
Loop, Parse, TagList, |
{
if A_LoopField = %TagToAdd%
{
TagNum = %A_Index%
}
}
if TagHolder = 1
{
IniRead, TagTaskList, %TagFile%, Tag%TagNum%, tasks
if (TagTaskList ="")
{
IniWrite, %ItemName%`@%ParentName%, %TagFile%, Tag%TagNum%, tasks
}
else
{
IniWrite, %TagTaskList%|%ItemName%`@%ParentName%, %TagFile%, Tag%TagNum%, tasks
}
}
if TagHolder = 2
{
IniRead, TagNoteList, %TagFile%, Tag%TagNum%, notes
if TagNoteList = ERROR
{
IniWrite, %ItemName%, %TagFile%, Tag%TagNum%, notes
}
else
{
IniWrite, |%ItemName%, %TagFile%, Tag%TagNum%, notes
}
}
if TagHolder = 3
{
IniRead, TagReminderList, %TagFile%, Tag%TagNum%, reminders
if TagReminderList = ERROR
{
IniWrite, %ItemName%, %TagFile%, Tag%TagNum%, reminders
}
else
{
IniWrite, |%ItemName%, %TagFile%, Tag%TagNum%, reminders
}
}
if TagHolder = 4
{
IniRead, TagOtherList, %TagFile%, Tag%TagNum%, others
if TagOtherList = ERROR
{
IniWrite, %ItemName%, %TagFile%, Tag%TagNum%, others
}
else
{
IniWrite, |%ItemName%, %TagFile%, Tag%TagNum%, others
}
}
}

0 comments on commit e2dcec3

Please sign in to comment.