Hai ..
here is my new pad with some modification to "simple desktop pad" I earlier send. And to use it multi purpose.
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"
* Access to new modifications with Numpad Pagedown & Pageup keys-- keep NumLock off
1. Appointments
This is simply like Task shedular and
To show your Appointment in pad or if need Run task with
Run buttons, also can addtional sond with
sound button.,
By pressing
Appointment button twice can apply your task
2. Prefix
Actually this is Hotstrings , can apply abbreviations for 5 Expands
And it can increase by
Apply button
By pressing
Prefix button twice can delete old prefix file and create New
Andreas Borutta's hotstring helper supported me to get this idea
* Prefix is actually Run new script and activates Hotsrings , And not work with Compiled exe, So you must have Autohot key installed in your PC.
I couldn't find better answer for this, If some one knows Pls tell me how to insert hotstring to a compiled script.
Code:
;2005-12-15 Nuwan :Simple desktop pad-Test
;-----------------------------------------------------------------------------
;Saving folder is WorkingDirectory (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
Pz=0
Az=1
;================================================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
Bak:
{
Gui, 2:font, cBlack
Gui, 2:font,, Times New Roman
Gui, 2:font, wBold s12
Gui, 2:Add, Text, x10 y10 ,Prefix
Gui, 2:Add, Text, x10 y10 ,Appointments
Gui, 2:font, wBold s10
Gui, 2:Add, Text, x10 y30 ,Abbreviation
Gui, 2:Add, Text, x10 y30 ,Time (hhmm)
Gui, 2:Add, Text, x120 y30 ,Appointment
Gui, 2:Add, Text, x120 y30 ,Expand . . . . .
Gui, 2:Add, edit,vpf1 x10 y50 w55 h30,
Gui, 2:Add, edit,vEx1 x70 y50 w180 h30,
Gui, 2:Add, Button, x260 y50 w40 h30 gplay1, Run1
Gui, 2:Add, edit,vpf2 x10 y90 w55 h30,
Gui, 2:Add, edit,vEx2 x70 y90 w180 h30,
Gui, 2:Add, Button, x260 y90 w40 h30 gplay2, Run2
Gui, 2:Add, edit,vpf3 x10 y130 w55 h30,
Gui, 2:Add, edit,vEx3 x70 y130 w180 h30,
Gui, 2:Add, Button, x260 y130 w40 h30 gplay3, Run3
Gui, 2:Add, edit,vpf4 x10 y170 w55 h30,
Gui, 2:Add, edit,vEx4 x70 y170 w180 h30,
Gui, 2:Add, Button, x260 y170 w40 h30 gplay4, Run4
Gui, 2:Add, edit,vpf5 x10 y210 w55 h30,
Gui, 2:Add, edit,vEx5 x70 y210 w180 h30,
Gui, 2:Add, Button, x260 y210 w40 h30 gplay5, Run5
Gui, 2:font, wBold s10
Gui, 2:Add, Button, x120 y246 w55 h30 gPfx, Prefix
Gui, 2:Add, Button, x175 y246 w55 h30 gApp, Appoint
Gui, 2:Add, Button, x230 y246 w54 h30 gSnd, Sound
Gui, 2:Add, Button, x230 y246 w54 h30 gPref, Apply
Gui, 2:+Resize
Gui, 2:-Border -Caption +ToolWindow
Xp:= A_SCREENWidth - 320
Yp:= A_SCREENHeight - 337
If pf1>%TM%
{
GuiControl, Focus, pf1
Send, %pf1%
GuiControl, Focus, Ex1
Send, %Ex1%
}
If pf2>%TM%
{
GuiControl, Focus, pf2
Send, %pf2%
GuiControl, Focus, Ex2
Send, %Ex2%
}
If pf3>%TM%
{
GuiControl, Focus, pf3
Send, %pf3%
GuiControl, Focus, Ex3
Send, %Ex3%
}
If pf4>%TM%
{
GuiControl, Focus, pf4
Send, %pf4%
GuiControl, Focus, Ex4
Send, %Ex4%
}
If pf5>%TM%
{
GuiControl, Focus, pf5
Send, %pf5%
GuiControl, Focus, Ex5
Send, %Ex5%
}
GuiControl, Focus, pf1
Gui, 2:Add, Text, x15 y246 ,%A_Hour%%A_Min% (Now)
Gui, 2:Show,x%XP% y%Yp%, Second Pad
Control, Hide,,Expand . . .,Second Pad
Control, Hide,, Apply,Second Pad
Gui, 2:Hide
SetTimer,clock,1000
}
:R:Nuwan::Nuwan
Return
;=================================================Appointments
App:
If Az=0
{
Control, Hide,, Prefix,Second Pad
Control, Hide,, Abbreviation,Second Pad
Control, Hide,,Expand . . .,Second Pad
Control, Hide,, Apply,Second Pad
Control, Show,, Time (hhmm),Second Pad
Control, Show,, Appointments,Second Pad
Control, Show,, Sound,Second Pad
GuiControl, 2:Enable,Run1
GuiControl, 2:Enable,Run2
GuiControl, 2:Enable,Run3
GuiControl, 2:Enable,Run4
GuiControl, 2:Enable,Run5
AZ=1
Pz=0
Return
}
If AZ=1
{
Gui, 2:Submit
Gui 2:Destroy
Gui, 2:font, cBlack
Gui, 2:font,, Times New Roman
Gui, 2:font, wBold s10
Gui, 2:Add, Button, x0 y0 w55 h30 gApp, Appoint
Gui, 2:Add, Button, x55 y0 w54 h30 gMess, Exit
Gui, Color, 8388736
Gui, +LastFound +ToolWindow
WinSet, TransColor, 8388736
Gui, 2:-Caption
Xp:= A_SCREENWidth - 120
Yp:= A_SCREENHeight - 58
Gui, 2:Show,x%XP% y%Yp%, Second Pad
WinSet, AlwaysOnTop, on, Second Pad
AZ=2
Return
}
If Az=2
{
AZ=0
Gui 2:Destroy
Gosub Bak
}
Gosub To
;=================================================Prefix
Pfx:
If Pz=0
{
Control, Hide,, Appointments,Second Pad
Control, Hide,, Time (hhmm),Second Pad
Control, Hide,, Sound,Second Pad
Control, Show,, Apply,Second Pad
Control, Show,, Prefix,Second Pad
Control, Show,, Abbreviation,Second Pad
Control, Show,,Expand . . .,Second Pad
GuiControl, 2:Disable,Run1
GuiControl, 2:Disable,Run2
GuiControl, 2:Disable,Run3
GuiControl, 2:Disable,Run4
GuiControl, 2:Disable,Run5
PZ=1
Az=0
Return
}
If Pz=1
{
FileDelete Prefix.ahk
Gosub Pref
Gui 2:Destroy
Gui, 2:font, cBlack
Gui, 2:font,, Times New Roman
Gui, 2:font, wBold s10
Gui, 2:Add, Button, x0 y0 w55 h30 gPfx, Prefix
Gui, 2:Add, Button, x55 y0 w54 h30 gMess, Exit
Gui, Color, 8388736
Gui, +LastFound +ToolWindow
WinSet, TransColor, 8388736
Gui, 2:-Caption
Xp:= A_SCREENWidth - 120
Yp:= A_SCREENHeight - 58
Gui, 2:Show,x%XP% y%Yp%, Second Pad
WinSet, AlwaysOnTop, on, Second Pad
PZ=2
Return
}
If Pz=2
{
PZ=0
Gui 2:Destroy
Gosub Bak
}
To:
;Return
;=================================================Gui Tab
NumpadPgUp::
{
Gui, 2:Hide
Gui, Show
}
Return
NumpadPgDn::
{
Gui, Hide
Gui, 2:Show
}
Return
NumpadDel::
{
Gui, Show
Gui, 2:Show
}
Return
;================================================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
{
;msgbox, %R2%-%R4%
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, ^{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
;================================================Clock
clock:
CN:=A_Now
StringMid,YMD,CN,1,8
StringMid,TM,CN,9,4
StringMid,SN,CN,13,2
C=0
Loop, 5
{
C++
If pf%C%=%TM%
{
If SN=00
{
If Ex%C%<>
{
Gosub Clk
Gosub Ex
Send, {Enter 2}*************************************
}
Gosub SF
SoundPlay, %Wav1%
Sleep, 2000
}
}
}
Return
SF:
{
If C=1
Run, %SF1%
If C=2
Run, %SF2%
If C=3
Run, %SF3%
If C=4
Run, %SF4%
If C=5
Run, %SF5%
}
Return
Ex:
{
If C=1
Send, %Ex1%
If C=2
Send, %Ex2%
If C=3
Send, %Ex3%
If C=4
Send, %Ex4%
If C=5
Send, %Ex5%
}
Return
Clk:
{
Gui, 2:Hide
Gui, Show
Gosub Fix
Send, {Enter}*************************************
Send, {Enter}/Message from Appointments\{Enter}
}
Return
;================================================Play
play1:
{
FileSelectFile, SelectedFile, 3, , Open a file,
If SelectedFile =
MsgBox, You didn't select anything.
Else
SF1=%SelectedFile%
}
Return
play2:
{
FileSelectFile, SelectedFile, 3, , Open a file,
If SelectedFile =
MsgBox, You didn't select anything.
Else
SF2=%SelectedFile%
}
Return
play3:
{
FileSelectFile, SelectedFile, 3, , Open a file,
If SelectedFile =
MsgBox, You didn't select anything.
Else
SF3=%SelectedFile%
}
Return
play4:
{
FileSelectFile, SelectedFile, 3, , Open a file,
If SelectedFile =
MsgBox, You didn't select anything.
Else
SF4=%SelectedFile%
}
Return
play5:
{
FileSelectFile, SelectedFile, 3, , Open a file,
If SelectedFile =
MsgBox, You didn't select anything.
Else
SF5=%SelectedFile%
}
Return
;================================================Sound
Snd:
{
FileSelectFile, SelectedFile, 3, , Open a file,Wave Files (*.Wav)
If SelectedFile =
MsgBox, You didn't select any wave sound file.
Else
Wav1=%SelectedFile%
}
Return
;================================================Prefix Apply
Pref:
D=0
Loop, 5
{
D++
AutoTrim Off
ClipboardOld = %ClipboardAll%
GuiControl, Focus, Ex%D%
Send ^{Home}+{End}
Clipboard =
Send ^c
ClipWait 1
If ErrorLevel
{
If D>1
{
Run, Prefix.ahk
}
Return
}
;=========================================================
StringReplace, Hotstring, Clipboard, ``, ````, All ; Do this replacement first to avoid interfering with the others below.
StringReplace, Hotstring, Hotstring, `r`n, ``r, All ; Using `r works better than `n in MS Word, etc.
StringReplace, Hotstring, Hotstring, `n, ``r, All
StringReplace, Hotstring, Hotstring, %A_Tab%, ``t, All
StringReplace, Hotstring, Hotstring, `;, ```;, All
Hotstring= :R:`::%Hotstring%
Clipboard = %Hotstring% ; Send to Clipboard.
;=========================================================
Send ^v
GuiControl, Focus, pf%D%
Send ^{Home}+{End}
Clipboard =
Send ^c
Send {Delete}
ClipWait 1
If ErrorLevel
{
If D>1
{
Run, Prefix.ahk
}
Return
}
GuiControl, Focus, Ex%D%
Send {Home}{Right 3}^v^{Home}+{End}^c
StringReplace, Hotstring, Clipboard, ``, ````, All
FileAppend, `n%Hotstring%, Prefix.ahk
GuiControl, Focus, Ex%D%
Send {Delete}
}
Run, Prefix.ahk
Clipboard = %ClipboardOld%
Return
Thanks for all comments and encouragements for me to post simple desktop pad with additional feachers.
if any modification pls inform me with your correction.
Nuwan
