Until someone comes up with a better solution.
SubNote is a very simple notepad attached to the desktop.
It autosaves to SubNote.ini every 10 secs, and remembers it's onscreen position.
Skrommel
;SubNote.ahk
; Very simple notepad attached to the desktop.
; Autosaves every 10 secs, remembers window position.
;Skrommel @ 2008
#SingleInstance,Ignore
#NoEnv
SetWinDelay,0
applicationname=SubNote
lf:=Chr(10)
IniRead,tab,%applicationname%.ini,Settings,tab
If tab=ERROR
{
tab=4
IniWrite,%tab%,%applicationname%.ini,Settings,tab
}
Gui,+Resize +Border +ToolWindow
Gui,Margin,0,0
Gui,Add,Edit,Vedit R15 T%tab% WantTab
Gui,Show,,%applicationname%
Gui,+LastFound
guiid:=WinExist()
WinGet,progmanid,ID,Program Manager ahk_class Progman
DllCall("SetParent","uint",guiid,"uint",progmanid)
IniRead,x,%applicationname%.ini,Settings,x
IniRead,y,%applicationname%.ini,Settings,y
IniRead,w,%applicationname%.ini,Settings,w
IniRead,h,%applicationname%.ini,Settings,h
If (x="ERROR" Or y="ERROR" Or w="ERROR" Or h="ERROR")
WinGetPos,x,y,w,h,ahk_id %guiid%
menu:=DllCall("user32\GetSystemMenu","UInt",guiid,"UInt",0)
DllCall("user32\DeleteMenu","UInt",menu,"UInt",0xF060,"UInt",0x0)
WinMove,ahk_id %guiid%,,% x,% y,% w,% h-1
WinMove,ahk_id %guiid%,,% x,% y,% w,% h+1
IniRead,text,%applicationname%.ini,Text,Text
If text=ERROR
text=
(
`n`t`t%applicationname%`n`t`t`t`tby`n1HourSoftware.com`n
%applicationname% is a very simple notepad attached to the desktop.
`tIt autosaves to %applicationname%.ini every 10 secs, and remembers it's onscreen position.
)
StringReplace,text,text,<<LF>>,%lf%,All
GuiControl,,edit,%text%
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,%applicationname%,NOTHING
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Default,%applicationname%
Menu,Tray,Tip,%applicationname%
SetTimer,SAVE,10000
OnExit,EXIT
Return
NOTHING:
Return
SAVE:
oldtext:=text
GuiControlGet,text,,edit
If (text<>oldtext)
{
save:=text
StringReplace,save,save,%lf%,,All
IniWrite,%save%,%applicationname%.ini,Text,Text
}
Else
text:=oldtext
Return
EXIT:
SetTimer,SAVE,Off
GuiControlGet,save,,edit
StringReplace,save,save,%lf%,<<LF>>,All
IniWrite,%save%,%applicationname%.ini,Text,Text
WinGetPos,x,y,w,h,ahk_id %guiid%
IniWrite,%x%,%applicationname%.ini,Settings,x
IniWrite,%y%,%applicationname%.ini,Settings,y
IniWrite,%w%,%applicationname%.ini,Settings,w
IniWrite,%h%,%applicationname%.ini,Settings,h
ExitApp
GuiSize:
If ErrorLevel = 1 ;minimized
Return
GuiControl,Move,edit,W%A_GuiWidth% H%A_GuiHeight%
Return