Here's a simple ToDo script that docks to the desktop. Comment out the dock to desktop section if you prefer normal GUI behaviour.
Code:
; simple dock to desktop todo script by Serenity (c) 2005
; double-click on entry to edit, right-click on entry to delete, click on column header to create new entry
#singleinstance force
; #notrayicon
; check for settings.ini file, create it if it doesn't exist:
ifnotexist, settings.ini
fileappend, [Position on Desktop]`nx=Center`ny=Center`n`n[Window Size]`nh=250`nw=175, settings.ini
; read docking location and gui size from ini file:
iniread, x, settings.ini, Position on Desktop, x
iniread, y, settings.ini, Position on Desktop, y
iniread, h, settings.ini, Window Size, h
iniread, w, settings.ini, Window Size, w
gui, font, s8 w700, tahoma
gui, +resize -caption +toolwindow ; toolwindow stops flicker of icon in taskbar
gui, add, listview, -E0x200 -LV0x10 -ReadOnly NoSort x1 y1 glist vlist, .:: ToDo :.
; read from todo.txt, create it if it doesn't exist:
ifnotexist, todo.txt
fileappend, , todo.txt
fileread, data, todo.txt
; populate the listview:
loop, parse, data, `,
{
if A_LoopField !=
lv_add("",A_LoopField)
}
gui, show, x%x% y%y% h%h% w%w%
process, exist
pid = %errorlevel%
; dock to desktop:
winget, hw_gui, ID, ahk_class AutoHotkeyGUI ahk_pid %pid%
hw_desktop := DllCall( "FindWindowEx", "uint", 0, "uint", 0, "str", "Progman", "uint", 0 ) ; WorkerW Progman
DllCall( "SetParent", "uint", hw_gui, "uint", hw_gui )
; end of dock to desktop section
return
list:
row = %A_EventInfo% ; store this
if A_GuiEvent = ColClick ; the user has clicked on the header
{
LV_Add("","new task")
}
if A_GuiEvent = DoubleClick
{
iItem := (A_EventInfo-1)
SendMessage, 0x1017, %iItem%, 0, SysListView321, ahk_pid %pid%
}
if A_GuiEvent = R ; double right-click
{
LV_Delete(row)
filedelete, todo.txt
; get the text from all the rows, delete the old todo.txt and create a new one:
Loop % LV_GetCount()
{
LV_GetText(task,A_Index)
fileappend, %task%`,, todo.txt
}
}
if A_GuiEvent = e ; the user has finished editing the field
{
filedelete, todo.txt
; get the text from all the rows, delete the old todo.txt and create a new one:
Loop % LV_GetCount()
{
LV_GetText(task,A_Index)
fileappend, %task%`,, todo.txt
}
}
return
guisize:
guicontrol, move, list, % "W" (A_GuiWidth - 2) "H" (A_GuiHeight - 2)
; prevent the horizontal bar from showing:
colwidth := (A_GuiWidth-2)
LV_ModifyCol(1,colwidth)
return
guiclose:
exitapp