[AHK] Different default text in comments for different categories
Posted: Sun Nov 10, 2019 2:19 pm
By default in Preferences -> Task -> Defaults you can type text which will be shown in the Comments tab of a new task. Unfortunately I didn't find any option that will set different text for different categories. Running UDT with -cm parameter if you have 2-3 categories would be Ok, but, suppose you have 10-12 categories, so you have to choose different buttons or hotkeys for each new task, like in the example below:
I think it will be more convenient if you press only one button (hotkey) and set different text for different categories of tasks.
Here is the code for AutoHotKey
Code: Select all
- cm "Comment text category X"
- cm "Comment text category X + 1"
Code: Select all
#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.
Numpad2::
ControlGetText, TextFromRichField, RICHEDIT50W2, ahk_exe ToDoList.exe ; RICHEDIT50W2 - the name of the comment tab
if StrLen(TextFromRichField) != 0
MsgBox, you have something in the text field: %TextFromRichField% ; Checking whether you have any other text in the comment tab
else
ControlGetText, CategoryName, ComboBox39, ahk_exe ToDoList.exe ; CombBox39 the name of the class of the input field for Category
if CategoryName = BooksToRead ; BooksToRead - is the name of category, replace it with a category from your TDL
{
TextForCategory_1 = Main points of the chapter: `n1. `n2. `n3. `nContradictions: `n1. `n2. ; Replace the text with yours
ControlSetText, RICHEDIT50W2, %TextForCategory_1% , ahk_exe ToDoList.exe ; RICHEDIT50W2 - the name of the comment tab
}
if CategoryName = EVD ; The name of second category
{
TextForCategory_1 = This text is for another category
ControlSetText, RICHEDIT50W2, %TextForCategory_1% , ahk_exe ToDoList.exe
}