Jump to content

Task List


Vindicator209
 Share

Recommended Posts

Heh. yeah I have trouble keeping track of all the stuff I have to do so i made this little script so I always have a list handy =D

Basically it's a little gui with a list that slides in from the left/right when you move your mouse to that area(like if I set it to left mode, I would move my mouse to the left side of the screen(in the middle).

To add/remove, or change settings you just right click, and it'll have a bunch of stuff you can do:

Add task

Remove task

Move it(left or right side)

Autohide

Stay on top

Clear all

If you set it to the right side of the screen then you have to move your mouse the right side, incase you didn't assume.

Note: to "delete a task" you have to click it FIRST then rightclick > Delete

You can also rightclick the top bar to change it's color, but you don't have the pictures anyway. I can upload those too.

If you uncheck autohide, you can also drag the list around using the top bar, you can choose to "keep on top" which is a good idea if that's what you want to do.

It saves your tasks to "MyTasks.txt" and your settings to "Config.ini".

Posted Image

EDIT: oops forgot the code:

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$LR = IniRead("Config.ini", "Options", "Loc", 0)
$AH = IniRead("Config.ini", "Options", "Autohide", 0)
$OT = IniRead("Config.ini", "Options", "Ontop", 1)
$Top = IniRead("Config.ini", "Options", "Topbar", "topbar1.bmp")
If $LR = 0 Then
    $AW_SLIDE_IN = 0x00040001
    $AW_SLIDE_OUT = 0x00050002
ElseIf $LR = 1 Then
    $AW_SLIDE_IN = 0x00040002
    $AW_SLIDE_OUT = 0x00050001
EndIf
$Open = True
If $LR = 0 Then
    $Form1 = GUICreate("TaskManBar", 200, 440, 0, (@DesktopHeight / 2) - 220, $WS_POPUP, $WS_EX_TOOLWINDOW)
ElseIf $LR = 1 Then
    $Form1 = GUICreate("TaskManBar", 200, 440, @DesktopWidth - 200, (@DesktopHeight / 2) - 220, $WS_POPUP, $WS_EX_TOOLWINDOW)
EndIf
GUISetBkColor(0x000000, $Form1)
$Pic = GUICtrlCreatePic($Top, 0, 0, 200, 30)
$ColorMenu = GUICtrlCreateContextMenu($Pic)
$Black = GUICtrlCreateMenuItem("Black", $ColorMenu)
$Red = GUICtrlCreateMenuItem("Red", $ColorMenu)
$Green = GUICtrlCreateMenuItem("Green", $ColorMenu)
$Blue = GUICtrlCreateMenuItem("Blue", $ColorMenu)
;$Button1 = GUICtrlCreateButton("Add Task", 0, 20, 200, 20, 0)
$List1 = GUICtrlCreateList("", 0, 30, 200, 410)
$ContextMenu = GUICtrlCreateContextMenu($List1)
$Button1 = GUICtrlCreateMenuItem("Add a task...", $ContextMenu)
$Button2 = GUICtrlCreateMenuItem("Delete selected task...", $ContextMenu)
GUICtrlCreateMenuItem("", $ContextMenu)
$Button4 = GUICtrlCreateMenuItem("Move L/R", $ContextMenu)
$Button5 = GUICtrlCreateMenuItem("Autohide", $ContextMenu)
$Button6 = GUICtrlCreateMenuItem("Stay on top", $ContextMenu)
$Button7 = GUICtrlCreateMenuItem("Clear all tasks", $ContextMenu)
GUICtrlCreateMenuItem("", $ContextMenu)
$Button3 = GUICtrlCreateMenuItem("Exit", $ContextMenu)
If $AH = 0 Then
    GUICtrlSetState($Button5, $GUI_CHECKED)
Else
    GUICtrlSetState($Button5, $GUI_UNCHECKED)
EndIf
If $OT = 0 Then
    GUICtrlSetState($Button6, $GUI_UNCHECKED)
    WinSetOnTop("TaskManBar","",0)
Else
    GUICtrlSetState($Button6, $GUI_CHECKED)
    WinSetOnTop("TaskManBar","",1)
EndIf
;$Button2 = GUICtrlCreateButton("Finished", 0, 450, 200, 20, 0)
GUISetState(@SW_SHOW)
$TaskList = FileRead("MyTasks.txt")
$Tasks = StringSplit($TaskList, "//", 1)
;_ArrayDisplay($Tasks)
For $i = 2 To $Tasks[0]
    GUICtrlSetData($List1, StringReplace($Tasks[$i], @CRLF, ""))
Next
While 1
    $mPos = MouseGetPos()
    If $AH = 0 Then
        If $LR = 0 Then
            If $Open = False Then
                If $mPos[0] < 2 Then
                    If $mPos[1] > (@DesktopHeight / 2) - 240 And $mPos[1] < (@DesktopHeight / 2) + 240 Then
                        _WinAnimate($Form1, $AW_SLIDE_IN, 500)
                        GUISetState(@SW_SHOW, $Form1)
                        $Open = True
                    EndIf
                EndIf
            EndIf
            If $Open = True Then
                If $mPos[0] > 220 Then
                    _WinAnimate($Form1, $AW_SLIDE_OUT, 500)
                    GUISetState(@SW_HIDE, $Form1)
                    $Open = False
                EndIf
            EndIf
        Else
            If $Open = False Then
                If $mPos[0] > @DesktopWidth - 2 Then
                    If $mPos[1] > (@DesktopHeight / 2) - 240 And $mPos[1] < (@DesktopHeight / 2) + 240 Then
                        _WinAnimate($Form1, $AW_SLIDE_IN, 500)
                        GUISetState(@SW_SHOW, $Form1)
                        $Open = True
                    EndIf
                EndIf
            EndIf
            If $Open = True Then
                If $mPos[0] < @DesktopWidth - 220 Then
                    _WinAnimate($Form1, $AW_SLIDE_OUT, 500)
                    GUISetState(@SW_HIDE, $Form1)
                    $Open = False
                EndIf
            EndIf
        EndIf
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button7
            $iMsgBoxAnswer = MsgBox(292,"Are you sure?","Are you sure you want to clear the whole list?")
Select
    Case $iMsgBoxAnswer = 6 ;Yes
        FileDelete("MyTasks.txt")
        GUICtrlSetData($List1,"")
    Case $iMsgBoxAnswer = 7 ;No

EndSelect
        Case $Black
            IniWrite("Config.ini", "Options", "Topbar", "topbar1.bmp")
            GUICtrlSetImage($Pic,"topbar1.bmp")
        Case $Red
            IniWrite("Config.ini", "Options", "Topbar", "topbar2.bmp")
            GUICtrlSetImage($Pic,"topbar2.bmp")
        Case $Green
            IniWrite("Config.ini", "Options", "Topbar", "topbar3.bmp")
            GUICtrlSetImage($Pic,"topbar3.bmp")
        Case $Blue
            IniWrite("Config.ini", "Options", "Topbar", "topbar4.bmp")
            GUICtrlSetImage($Pic,"topbar4.bmp")
        Case $Pic
            Drag()
            If $AH = 0 Then
                If $LR = 1 Then
                WinMove("TaskManBar", "", @DesktopWidth - 200, (@DesktopHeight / 2) - 235)
                Else
                WinMove("TaskManBar", "", 0, (@DesktopHeight / 2) - 235)
                EndIf
            EndIf
        Case $Button6
            If $OT = 0 Then
                $OT = 1
                GUICtrlSetState($Button6, $GUI_CHECKED)
                IniWrite("Config.ini", "Options", "Ontop", 1)
                WinSetOnTop("TaskManBar","",1)
            Else
                $OT = 0
                GUICtrlSetState($Button6, $GUI_UNCHECKED)
                IniWrite("Config.ini", "Options", "Ontop", 0)
                WinSetOnTop("TaskManBar","",0)
            EndIf
        Case $Button5
            If $AH = 0 Then
                $AH = 1
                GUICtrlSetState($Button5, $GUI_UNCHECKED)
                IniWrite("Config.ini", "Options", "Autohide", 1)
                If $LR = 1 Then
                WinMove("TaskManBar", "", @DesktopWidth - 200, (@DesktopHeight / 2) - 235)
                Else
                WinMove("TaskManBar", "", 0, (@DesktopHeight / 2) - 235)
                EndIf
            Else
                $AH = 0
                GUICtrlSetState($Button5, $GUI_CHECKED)
                IniWrite("Config.ini", "Options", "Autohide", 0)
                If $LR = 1 Then
                WinMove("TaskManBar", "", @DesktopWidth - 200, (@DesktopHeight / 2) - 235)
                Else
                WinMove("TaskManBar", "", 0, (@DesktopHeight / 2) - 235)
                EndIf
            EndIf
        Case $Button4
            If $LR = 0 Then
                $LR = 1
                IniWrite("Config.ini", "Options", "Loc", 1)
                WinMove("TaskManBar", "", @DesktopWidth - 200, (@DesktopHeight / 2) - 235)
            Else
                $LR = 0
                IniWrite("Config.ini", "Options", "Loc", 0)
                WinMove("TaskManBar", "", 0, (@DesktopHeight / 2) - 235)
            EndIf
            If $LR = 0 Then
                $AW_SLIDE_IN = 0x00040001
                $AW_SLIDE_OUT = 0x00050002
            ElseIf $LR = 1 Then
                $AW_SLIDE_IN = 0x00040002
                $AW_SLIDE_OUT = 0x00050001
            EndIf
        Case $Button1
            $NewTask = InputBox("New Task!", "Enter your new task!", Default, Default, 300, 200)
            FileWriteLine("MyTasks.txt", "//" & $NewTask)
            GUICtrlSetData($List1, $NewTask)
        Case $Button2
            If GUICtrlRead($List1) = "" Then
                MsgBox(48, "Oops!", "You haven't selected a task!")
            Else
                $EndTask = GUICtrlRead($List1)
                $List = FileRead("MyTasks.txt")
                $List = StringReplace($List, "//" & $EndTask, "")
                FileDelete("MyTasks.txt")
                FileWrite("MyTasks.txt", $List)
                $TaskList = FileRead("MyTasks.txt")
                $Tasks = StringSplit($TaskList, "//", 1)
                GUICtrlSetData($List1, "")
                For $i = 2 To $Tasks[0]
                    GUICtrlSetData($List1, StringReplace($Tasks[$i], @CRLF, ""))
                Next
            EndIf
        Case $Button3
            Exit
    EndSwitch
WEnd
Func _WinAnimate($v_gui, $i_mode, $i_duration = 1000)
    If @OSVersion = "WIN_XP" Or @OSVersion = "WIN_2000" Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", WinGetHandle($v_gui), "int", $i_duration, "long", $i_mode)
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndIf
EndFunc   ;==>_WinAnimate
Func Drag()
    DllCall("user32.dll", "int", "ReleaseCapture")
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $Form1, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)
EndFunc   ;==>Drag

Pictures.zip

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

  • 7 years later...

I like the idea and was about to create something myself.

But, why reinvent the wheel?

Do you see this having a problem running in Windows 10?

I double click, but nothing happens (after I've added the script to the same directory).

-israel

Link to comment
Share on other sites

  • Moderators

@ideleon007 did you notice this thread is almost 8 years old? Or that the OP hasn't visited the forum in 2? AutoIt is an ever-evolving language, it is no surprise that something written so long ago, for another OS, may not work on the latest.

Rather than resurrecting an old thread, you would be better off creating a new thread in General Help and Support and giving a detailed description of what you're attempting to accomplish. If you would like, you can even link back to this post for reference. That will get many more eyes looking at your issue, and you'll be much more likely to receive assistance.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...