;Ala-Vista Note App ; ;Note v1.1 ; ;No alarm yet! ;Double click to save last position. IfNotExist, Notepad FileCreateDir, Notepad IfNotExist, Notepad\Number.txt FileAppend, 1, Notepad\Number.txt IfNotExist, Notepad\Note1.txt FileAppend, , Notepad\Note1.txt IfNotExist, Notepad\*.bmp { UrlDownloadToFile, http://www.autohotkey.net/~jk7800/Note/Cancel.bmp, Notepad\Cancel.bmp UrlDownloadToFile, http://www.autohotkey.net/~jk7800/Note/new.bmp, Notepad\new.bmp UrlDownloadToFile, http://www.autohotkey.net/~jk7800/Note/Note.bmp, Notepad\Note.bmp UrlDownloadToFile, http://www.autohotkey.net/~jk7800/Note/Save.bmp, Notepad\Save.bmp } Menu, tray, add, Enable/Disable window, EnableDisable, 1 Menu, Tray, Default, Enable/Disable window Enabled=1 Number=1 MaxNum=1 Note1=Click here to create new note. notwriting=1 FileRead, Gui, Notepad\LastPos.txt StringSplit, Gui, Gui, * Gui +LastFound +Owner +AlwaysOnTop -Caption GUI_ID:=WinExist() Gui, Margin, 0, 0 Gui, Color, FAF99F Gui, Add, Picture, gDelete x4 y4, Notepad\Cancel.bmp Gui, Add, Picture, gSave x72 y4, Notepad\Save.bmp Gui, Add, Picture, gNew x91 y4, Notepad\New.bmp Gui, Add, Text, BackgroundTrans gEdit vNoteRead x4 y26 W99 H78, Gui, Add, Edit, vNoteWrite R5 x4 y26 W99 H76, GuiControl, Hide, NoteWrite Gui, Add, Text, BackgroundTrans gPrev x4 y104, %A_Space%<%A_Space% Gui, Add, Text, BackgroundTrans gNext x14 y104, %A_Space%>%A_Space% Gui, Add, Picture, vBackground 0x4000000 gStopWriting x0 y0, Notepad\Note.bmp GuiControl, Show, NoteRead GuiControl, , NoteRead, Click here to create new note. SysGet, VirtualScreenWidth, 78 SysGet, VirtualScreenHeight, 79 VirtualScreenWidth-=113 VirtualScreenHeight-=121 if(Gui1<0 or Gui2<0 or Gui1>VirtualScreenWidth or Gui2>VirtualScreenHeight) { Gui, Show, , Notepad WinGetPos, Gui_X, Gui_Y, , , ahk_id %GUI_ID% FileDelete, Notepad\LastPos.txt FileAppend, %Gui_X%*%Gui_Y%, Notepad\LastPos.txt } Else Gui, Show, x%Gui1% y%Gui2%, Notepad WinSet, TransColor, FF00FF 255, ahk_id %GUI_ID% Loop, Notepad\Note*.txt FileRead, Note%A_Index%, %A_LoopFileLongPath% GuiControl, , NoteRead, %Note1% FileRead, MaxNum, Notepad\Number.txt if(Note1="") GuiControl, , NoteRead, Click here to create new note. goto EnableDisable Return StopWriting: if (notwriting=1) { if(A_GuiEvent="DoubleClick") { WinGetPos, Gui_X, Gui_Y, , , ahk_id %GUI_ID% FileDelete, Notepad\LastPos.txt FileAppend, %Gui_X%*%Gui_Y%, Notepad\LastPos.txt Return } PostMessage, 0xA1, 2,,, A Return } GuiControlGet, Note,, NoteWrite GuiControl, Show, NoteRead GuiControl, Hide, NoteWrite gosub Save if(Note=="") GuiControl, , NoteRead, Click here to create new note. Else GuiControl, , NoteRead, %Note% notwriting=1 Return Save: if (notwriting=1) GuiControlGet, Note,, NoteRead Else GuiControlGet, Note,, NoteWrite GuiControl, , NoteRead, %Note% GuiControl, Show, NoteRead GuiControl, Hide, NoteWrite Note%Number%:=Note FileDelete, Notepad\Note%Number%.txt FileAppend, %Note%, Notepad\Note%Number%.txt Return New: if (notwriting=0) gosub Save Else notwriting=0 MaxNum+=1 FileDelete, Notepad\Number.txt FileAppend, %MaxNum%, Notepad\Number.txt Number:=MaxNum GuiControl, , NoteRead, Click here to create new note. GuiControl, , NoteWrite, GuiControl, Hide, NoteRead GuiControl, Show, NoteWrite Return Edit: GuiControlGet, Note,, NoteRead if(Note=="Click here to create new note.") GuiControl, , NoteWrite, Else GuiControl, , NoteWrite, %Note% GuiControl, Hide, NoteRead GuiControl, Show, NoteWrite notwriting=0 Return Prev: if(Number=1) Return Number-=1 if(Number<1) Number=1 Note:=Note%Number% if (notwriting=1) GuiControl, , NoteRead, %Note% Else GuiControl, , NoteWrite, %Note% Return Next: if(Number=MaxNum) Return Number+=1 Note:=Note%Number% if (notwriting=1) GuiControl, , NoteRead, %Note% Else GuiControl, , NoteWrite, %Note% Return Delete: if (notwriting=1) { if(MaxNum=1) { FileDelete, Notepad\Note1.txt FileAppend, , Notepad\Note1.txt GuiControl, , NoteWrite, GuiControl, , NoteRead, Click here to create new note. Return } Loop %MaxNum% { NumberCopyTo:=A_Index+Number-1 NumberCopyFrom:=A_Index+Number Note%NumberCopyTo%:=Note%NumberCopyFrom% Note:=Note%A_Index% FileDelete, Notepad\Note%A_Index%.txt FileAppend, %Note%, Notepad\Note%A_Index%.txt } FileDelete, Notepad\Note%MaxNum%.txt MaxNum-=1 FileDelete, Notepad\Number.txt FileAppend, %MaxNum%, Notepad\Number.txt if (Number>1) Number:=MaxNum Note:=Note%Number% GuiControl, , NoteRead, %Note% } Else { Note:=Note%Number% GuiControl, , NoteRead, %Note% notwriting=1 GuiControl, Show, NoteRead GuiControl, Hide, NoteWrite } Return EnableDisable: if(Enabled=1) { WinSet, ExStyle, +0x20, ahk_id %GUI_ID% Loop 11 { Sleep, 25 TMPTrans:=255-A_Index*8 WinSet, TransColor, FF00FF %TMPTrans%, ahk_id %GUI_ID% } WinSet, TransColor, FF00FF 159, ahk_id %GUI_ID% Enabled=0 if(notwriting=0) goto StopWriting }Else{ WinSet, ExStyle, -0x20, ahk_id %GUI_ID% Loop 11 { Sleep, 25 TMPTrans:=159+A_Index*8 WinSet, TransColor, FF00FF %TMPTrans%, ahk_id %GUI_ID% } WinSet, TransColor, FF00FF 255, ahk_id %GUI_ID% Enabled=1 } Return