Hai
Here is my simple desktop pad - Totally GUI basis
To save and enter simple notes / contact details / phone numbers
I think this is very easy than Note pad.
GUI Move (Win+Arrow keys)
Numbering system with "Numpad Enter"
Code:
;2005-12-01 Nuwan :Simple desktop pad-Test
;-----------------------------------------------------------------------------
;Saving folder is HOMEPATH (Place where the compiled exe file located)
;-----------------------------------------------------------------------------
;================================================Variables
R1=200
R2=400
R3=185
R4=147
N=0
P=0
Q=0
A=1
B=0
;================================================GUI
Gui, font, cBlack
Gui, Add, edit,vMainEdit x200 y400 w185 h147 ,
Gui, font,, Times New Roman
Gui, font, wBold s10
Gui, Add, Button, x327 y546 w60 h30 gMess, Exit
Gui, Add, Button, x266 y546 w60 h30 gOpt, Options
Gui, Add, Button, x144 y546 w60 h30 gTrans, Trans
Gui, Add, Button, x22 y515 w60 h30 gHeightA, Height +
Gui, Add, Button, x83 y515 w60 h30 gWidthA, Width +
Gui, Add, Button, x22 y546 w60 h30 gHeightD, Height -
Gui, Add, Button, x83 y546 w60 h30 gAppo, New
Gui, Add, Button, x144 y515 w60 h30 gWidthD, Width -
Gui, Add, Button, x205 y546 w60 h30 gSave, Save
Gui, Color, C0C0C0
Gui, +Lastfound
WinSet, TransColor, C0C0C0
Gui, -Caption +ToolWindow
Xp:= A_ScreenWidth - 400
Yp:= A_ScreenHeight - 604
Gui, Show,x%XP% y%Yp%, Desktop Pad
Control, Hide,, Height +,
Control, Hide,, Width +,
Control, Hide,, Height -,
Control, Hide,, Width -,
Control, Hide,, New,
Control, Hide,, Trans,
WinSet, AlwaysOnTop, on, Desktop Pad
;================================================Numbering
NumpadEnter::
IfWinActive, Desktop Pad
{
B:=B+1
Send {Enter} %B%.{Space}
}
else
Send {Enter}
Return
;================================================WinMove
#right::
wingetpos x, y,,, Desktop Pad
x += 50
winmove, Desktop Pad,,%x%, %y%
return
#left::
wingetpos x, y,,, Desktop Pad
x -= 50
winmove, Desktop Pad,,%x%, %y%
return
#Up::
wingetpos x, y,,, Desktop Pad
y -= 50
winmove, Desktop Pad,,%x%, %y%
return
#Down::
wingetpos x, y,,, Desktop Pad
y += 50
winmove, Desktop Pad,,%x%, %y%
return
;================================================Exit Message
Mess:
MsgBox ,4,, Do you want to Save before exit ?
IfMsgBox, No
ExitApp
else
{
Gosub, Save
ExitApp
}
Exit:
GuiClose:
ExitApp
;================================================Dimensions
HeightA:
if R4>526
{
Gosub Fix
}
else
{
R2 -= 20
R4 += 20
Gosub Dimen
Gosub Fix
}
Return
HeightD:
if R4<20
{
Gosub Fix
}
else
{
R2 += 20
R4 -= 20
Gosub Dimen
Gosub Fix
}
Return
WidthA:
If R3=185
{
R2 -= 30
}
if R3>364
{
Gosub Fix
}
else
{
R1 -= 20
R3 += 20
Gosub Dimen
Gosub Fix
}
Return
WidthD:
If R3=205
{
R2 += 30
}
if R3<20
{
Gosub Fix
}
else
{
R1 += 20
R3 -= 20
Gosub Dimen
Gosub Fix
}
Return
Dimen:
ControlMove, %MainEdit%, %R1%, %R2%, %R3% ,%R4%
Return
;================================================New Sheet
Appo:
if N<>0
{
GuiControlGet, MainEdit
FileDelete %CurrentFileName% - %A%.txt
if ErrorLevel <> 0
{
MsgBox The attempt to overwrite "%CurrentFileName% - %A%.txt" failed.
return
}
FileAppend, This is saved at:- %tsa%- - , %CurrentFileName% - %A%.txt
FileAppend, %MainEdit%, %CurrentFileName% - %A%.txt
FileAppend, %S%, %CurrentFileName% - %A%.txt
}
GuiControl, Focus, MainEdit
Send, ^{HOME}^+{END}{DELETE}
N=0
B=0
A += 1
Return
;================================================GUI Button Show/Hide
opt:
Gosub Fix
if Q=0
{
If R2+R4=547 and If R3>185
{
R2 -= 30
Gosub Dimen
}
Control, Show,, Trans,
Control, Show,, New,
Control, Show,, Width -,
Control, Show,, Height -,
Control, Show,, Width +,
Control, Show,, Height +,
Q=1
return
}
if Q=1
{
If R2+R4=517 and If R3>185
{
R2 += 30
Gosub Dimen
}
Control, Hide,, Height +,
Control, Hide,, Width +,
Control, Hide,, Height -,
Control, Hide,, Width -,
Control, Hide,, New,
Control, Hide,, Trans,
Q=0
}
return
;================================================Transparent
Trans:
Gosub Fix
if P=0
{
P=1
Gui, Color, White
WinSet, TransColor, White
return
}
if P=1
{
P=0
Gui, Color, C0C0C0
WinSet, TransColor, C0C0C0
}
return
;================================================Save
Save:
{
FormatTime, cfn,,yyyy_MM_dd
FormatTime, tsa,,HH:mm' on 'dd-MM-yyyy
CurrentFileName = %cfn%
if N=0
{
GuiControl, Focus, MainEdit
;------------------------------------Write Begin
Send, ^{HOME}{ENTER}
Send, ------------------------------------------------------
Send, {ENTER}
Send, ^{END}{ENTER 3}
Send, ------------------------------------------------------
Send, {ENTER}/ DesktopPad %A% \ -{SPACE}{UP 4}{END}
;------------------------------------Write End
IfExist %CurrentFileName% - %A%.txt
{
FileRead , S,%CurrentFileName% - %A%.txt
GuiControlGet, MainEdit
FileDelete %CurrentFileName% - %A%.txt
if ErrorLevel <> 0
{
MsgBox The attempt to overwrite "%CurrentFileName% - %A%.txt " failed.
return
}
FileAppend, This is saved at:- %tsa%- - , %CurrentFileName% - %A%.txt
FileAppend, %MainEdit%, %CurrentFileName% - %A%.txt
FileAppend, %S%, %CurrentFileName% - %A%.txt
MsgBox, Saved as %CurrentFileName% - %A%.txt
}
Else
{
GuiControlGet, MainEdit
FileAppend, This is saved at:- %tsa%- - , %CurrentFileName% - %A%.txt
FileAppend, %MainEdit%, %CurrentFileName% - %A%.txt
Msgbox, %CurrentFileName% - %A%.txt Created
}
}
IfExist %CurrentFileName% - %A%.txt
if N<>0
{
GuiControl, Focus, MainEdit
Send, ^{END}{UP 4}{END}
GuiControlGet, MainEdit
FileDelete %CurrentFileName% - %A%.txt
if ErrorLevel <> 0
{
MsgBox The attempt to overwrite "%CurrentFileName% - %A%.txt " failed.
return
}
FileAppend, This is saved at:- %tsa%- - , %CurrentFileName% - %A%.txt
FileAppend, %MainEdit%, %CurrentFileName% - %A%.txt
FileAppend, %S%, %CurrentFileName% - %A%.txt
MsgBox, Saved as %CurrentFileName% - %A%.txt
}
N += 1
}
return
;================================================Cursor position
Fix:
if N=0
{
GuiControl, Focus, MainEdit
Send, ^{END}
GuiControl, +Redraw, MainEdit
Return
}
if N<>0
{
GuiControl, Focus, MainEdit
Send, ^{END}{UP 4}{END}
GuiControl, +Redraw, MainEdit
}
Return
And I like more suggestions and better implementations without bugs.
Thanks
Nuwan