giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.41k stars 461 forks source link

Request: Check/Uncheck All ToDo #1365

Open metal450 opened 3 years ago

metal450 commented 3 years ago

I love CherryTree's "ToDo" list feature - I use it for i.e. shopping lists, daily task lists, etc. However, one thing I constantly find myself doing is 'resetting' lists by slowly, manually clicking each item one at a time (i.e. to get a clear list at the start of the day, or the next time I go shopping, etc). It would be an immensely handy time-saver if there were a single command to "Toggle All ToDo Checkboxes In Current Node" :)

userfav commented 3 years ago

I don't know when or how then can make possible the feature that you're asking (I also want it) so for the time being I made for myself a simple autohotkey script to uncheck the to-dos (this is for Windows, I guess it's possible to make something similar on Linux) using the "Replace in node content" function.

When you press "Ctrl + Alt + u" (for uncheck) and you are on Cherrytree, the script ask if you want to uncheck the marked squares and if you accept proceeds.

Script content:


; Autohotkey Script to Uncheck cherrytree to-dos
; The script file needs to be saved as "UTF-8 with BOM" to work!
; USE IT AT YOUR OWN RISK!
; 2020-12-02

#IfWinActive, ahk_exe cherrytree.exe ; to only work if you are on Cherrytree

^!u::  ; hotkey: Ctrol + Alt + u (also AltGr + u)

MsgBox, 4,, Uncheck the to-dos? ; question to proceed
IfMsgBox Yes
{
    Send {Shift up} ; to prevent the "Replace All" Window
    Send ^h         ; run the hotkey assigned to search and replace 
    Send {BS}
    Send ☑          ; the symbol to be replaced
    Send {Tab}
    Send ☐          ; the uncheck symbol to be used
    Send {Tab 9}
    Send {Enter}
    Send {Esc}      ; to hide the "matchs replaced window info" or the "no matchs found" window
}
return

Demo:

demo

Script:

uncheck_CT_to-dos.zip