Advertisement
Najeebsk

STICKENOTES.au3

Nov 29th, 2022
2,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.64 KB | None | 0 0
  1. FileInstall(".\bkg.bmp",@tempdir & "\bkgforstickenotes.bmp")
  2. FileSetAttrib(".\bkgforstickenotes.bmp","+H")
  3. If winexists("stickenotes") = 0 Then
  4. Opt("TrayMenuMode",1)
  5. TraySetIcon(".\tray.ico")
  6. TraySetToolTip("Stick-E-Notes is running :-)")
  7. Else
  8.    Opt("TrayIconHide",1)
  9. EndIf
  10. #include<WindowsConstants.au3>
  11. #include<GUIConstantsEx.au3>
  12. #include<TrayConstants.au3>
  13. Opt("MouseCoordMode",0)
  14. GUICreate("stickenotes",200,200,-1,-1,BitOr($WS_POPUP,$WS_BORDER),$WS_EX_TOOLWINDOW)
  15. GUICtrlCreatePic(@tempdir & "\bkgforstickenotes.bmp",0,0,200,200)
  16. GUICtrlSetState(-1, $GUI_DISABLE)
  17. $title_label=GUICtrlCreateLabel("",0,10,200,15,0x01)
  18. GUICtrlSetFont(-1,-1,-1,-1,"Fixedsys")
  19. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  20. GUICtrlSetState(-1,$GUI_HIDE)
  21. $memo_label=GUICtrlCreateLabel("",10,44,180,160)
  22. GUICtrlSetFont(-1,-1,-1,-1,"Verdana")
  23. GUICtrlSetBkColor(-1,0xEFE4B0)
  24. GUICtrlSetState(-1,$GUI_HIDE)
  25. GUISetState(@SW_SHOW)
  26. While 1
  27.    $msg = GUIGetMsg()
  28.    Select
  29.    Case $msg=$GUI_EVENT_PRIMARYUP
  30.       $primpos=MouseGetPos(1)
  31.       $primpos2=MouseGetPos(0)
  32.       If $primpos < 34 then
  33.          If $primpos2 > 173 then
  34.             $a=Msgbox(36,"Confirm action","Do you want to delete this note?")
  35.             If $a=6 then Exit
  36.             If $a=7 then ContinueLoop
  37.             EndIf
  38.          If $primpos2 < 26 Then
  39.             msgbox(64,"Stick-E-Notes: Usage","- Click the title bar to rename the note." & @CRLF & "- Press Del Note to delete and close the note (after confirmation)" & @CRLF & "- Click the note body to change the contents of the note." & @CRLF & "- Right click the note body to move the note around on the desktop." & @CRLF & "- To create multiple notes, simply open another instance of this app :-)" & @CRLF & "- To bring focus to your notes, click the tray icon.")
  40.             ContinueLoop
  41.             EndIf
  42.  
  43.          $title=InputBox("Stick-E-Notes","Define note title","")
  44.          If $title <> "" Then
  45.             If StringLen($title) > 18 then $title=StringTrimRight($title,StringLen($title)-18)
  46.             GUICtrlSetData($title_label,$title)
  47.             GUICtrlSetState($title_label,$GUI_SHOW)
  48.          EndIf
  49.       EndIf
  50.       If $primpos > 34 then
  51.          $memo=InputBox("Stick-E-Notes","Define note text",GUICtrlRead($memo_label))
  52.          If not @error Then
  53.             GUICtrlSetData($memo_label,$memo)
  54.             GUICtrlSetState($memo_label,$GUI_SHOW)
  55.             EndIf
  56.          EndIf
  57.       Case $msg = $GUI_EVENT_SECONDARYDOWN
  58.          $mprimcords=mousegetpos()
  59.          Opt("MouseCoordMode",1)
  60.          Do
  61.             $msg=guigetmsg()
  62.          $cords=MouseGetPos()
  63.          WinMove("stickenotes","",$cords[0]-$mprimcords[0],$cords[1]-$mprimcords[1])
  64.       Until $msg = $GUI_EVENT_SECONDARYUP
  65.       Opt("MouseCoordMode",2)
  66.    EndSelect
  67.    $tmsg=TrayGetMsg()
  68.    If $tmsg=$TRAY_EVENT_PRIMARYDOWN then
  69.       WinActivate("stickenotes")
  70.    Endif
  71. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement