Notiz - APP
Posted: 15 Apr 2016, 06:00
Hallo,
ich habe eine kleine Notiz-App geschrieben.
ich habe eine kleine Notiz-App geschrieben.
Code: Select all
#NoTrayIcon
#SingleInstance force
Process, Priority,,Low
ListLines, Off
SetWinDelay,-1
SetControlDelay, -1
CoordMode,mouse,screen
edittab=>1<
WinGetActiveTitle,lasttitle
IniRead,x,msgnote.ini,MAIN,x,20
IniRead,y,msgnote.ini,MAIN,y,20
IniRead,w,msgnote.ini,MAIN,w,300
IniRead,h,msgnote.ini,MAIN,h,160
IniRead,tt1,msgnote.ini,MAIN,text1,0
Stringreplace,tt1,tt1,|,`r`n,all
IniRead,tt2,msgnote.ini,MAIN,text2,0
Stringreplace,tt2,tt2,|,`r`n,all
IniRead,tt3,msgnote.ini,MAIN,text3,0
Stringreplace,tt3,tt3,|,`r`n,all
h:=400
mnh:=300
msgnotewinsmallonoff=off
Hotkey,IfWinActive,msgnote
hotkey,f1,set
hotkey,wheelup,wu
hotkey,wheeldown,wd
edittaban:=1
textview:=tt%edittaban%
Gui,3: +LastFound
gui,3: color,white,blue
Gui,3: +Border -Caption +AlwaysOnTop +ToolWindow -SysMenu +Owner +resize +OwnDialogs
gui,3: font,S10
gui,3: margin,0,0
gui,3: font,S10
gui,3: add,button,section gwait,X
gui,3: add,button,ys,M
gui,3: add,button,ys gtc1,1
gui,3: add,button,ys gtc2,2
gui,3: add,button,ys gtc3,3
gui,3: font,S16
gui,3: add,text,ys vud,Uhrzeit : Datrum *
gui,3: add,edit, cwhite xs section r5 w350 -VScroll -hScroll vMainEdit,%textview%
gui,3: show,x%x% y%y% w%w% h%h% ,msgnote
ControlFocus,Edit1,msgnote
Critical
SetBatchLines, -1
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
sendinput,{pgdn}
loop,50
sendinput,{down}
;MyWindowID := WinExist("msgnote")
;OnMessage(0x201,"WM_LBUTTONDOWN")
WinSet, Transparent, 180,msgnote
WinActivate,%lasttitle%
WinGetPos,mnx,mny,mnw,mnh,msgnote
cw:=mnw-w
WinMove,msgnote,,,,,45,
maxwin=off
settimer,check,500
save=ok
gui,3: color,yellow,blue
edittab=>1<
return
tc1:
ControlGetText,tt,Edit1,msgnote
tt%edittaban%:=tt
gui,3: color,yellow,blue
edittab=>1<
edittaban:=1
textview:=tt%edittaban%
ControlSetText,Edit1,%textview%,msgnote
return
tc2:
ControlGetText,tt,Edit1,msgnote
tt%edittaban%:=tt
gui,3: color,Fuchsia,blue
edittab=>2<
edittaban:=2
textview:=tt%edittaban%
ControlSetText,Edit1,%textview%,msgnote
return
tc3:
ControlGetText,tt,Edit1,msgnote
tt%edittaban%:=tt
gui,3: color,Lime,blue
edittab=>3<
edittaban:=3
textview:=tt%edittaban%
ControlSetText,Edit1,%textview%,msgnote
return
;##########################################################
wu:
sendinput,{up}
return
wd:
sendinput,{down}
return
set:
FormatTime,t,, dd.MM , HH:mm
sendinput,---%t%-------------------{enter}
return
;##########################################################
check:
bl:=A_sec/2 ; Blink
ifinstring,bl,.5
{
FormatTime,ts,,dddd - MMMM d, HH:mm
ControlSetText,Static1,%edittab% %ts%,msgnote
}
else
{
FormatTime,ts,,dddd - MMMM d, HH mm
ControlSetText,Static1,%edittab% %ts%,msgnote
}
MouseGetPos, , , win, control
WinGetTitle, title, ahk_id %win%
if title=msgnote
{
if control=Button2
{
GetKeyState, state,LButton
if state=D
{
Critical
SetBatchLines, -1
settimer,check,off
WinGetPos,xxs,yys,,,msgnote
MouseGetPos,xms,yms
Loop
{
GetKeyState, state,LButton, P
if state = U ; The key has been released, so break out of the loop.
break
MouseGetPos, xs, ys
xxx:=round(xxs-(xms-xs))
yyy:=Round(yys-(yms-ys))
WinMove,msgnote,,%xxx%,%yyy%
}
settimer,check,500
WinGetPos,x,y,,,msgnote
MouseMove,%x%,%y%
}
return
}
if maxwin=off
{
WinMove,msgnote,,%mnx%,%mny%,%mnw%,%mnh%
WinActivate,msgnote
ControlFocus,Edit1,msgnote
maxwin=on
save=off
SoundBeep,1000,50
return
}
}
else
{
maxwin=off
if save=off
{
WinGetPos,mnx,mny,mnw,mnh,msgnote
savepos("msgnote")
SoundBeep,1700,50
save=ok
}
WinMove,msgnote,,,,,45
}
return
;##########################################################
3guisize:
NewWidth := A_GuiWidth
NewHeight := A_GuiHeight
GuiControl, Move, MainEdit, W%NewWidth% H%NewHeight%
return
savepos(win)
{
sleep,100
global tt,cw,maxwin,edittaban,tt1,tt2,tt3,edittaban
WinGetPos,x,y,w,h,%win%
ControlGetText,tt,Edit1,msgnote
tt%edittaban%:=tt
w:=w-cw
IniWrite,%x%,msgnote.ini,MAIN,x
IniWrite,%y%,msgnote.ini,MAIN,y
IniWrite,%w%,msgnote.ini,MAIN,w
IniWrite,%h%,msgnote.ini,MAIN,h
Stringreplace,stt,tt1,`r`n,|,all
IniWrite,%stt%,msgnote.ini,MAIN,text1
Stringreplace,stt,tt2,`r`n,|,all
IniWrite,%stt%,msgnote.ini,MAIN,text2
Stringreplace,stt,tt3,`r`n,|,all
IniWrite,%stt%,msgnote.ini,MAIN,text3
}
max:
~esc::
if maxwin=on
{
WinActivate,%lasttitle%
WinGetPos,x,y,,,%lasttitle%
MouseMove,%x%,%y%
SoundBeep,500,50
return
}
WinGetActiveTitle,lasttitle
CoordMode,mouse,screen
MouseMove,%mnx%,%mny%
SoundBeep,2000,50
return
!F12::
if maxwin=off
WinMove,msgnote,,%mnx%,%mny%,%mnw%,%mnh%
savepos("msgnote")
exitapp
wait:
settimer,check,off
loop,180
{
t:=180-a_index
WinSet, Transparent,%t%,msgnote
sleep,1
}
SoundBeep,500,50
winhide,msgnote
sleep,10000
winshow,msgnote
SoundBeep,500,50
settimer,check,500
loop,180
{
WinSet, Transparent,%a_index%,msgnote
sleep,1
}
return