Jump to content

Recommended Posts

Brincando um pouco no autoit eu fiz esse programa de cronograma de estudos, se alguém estiver afim de estudar, ele seleciona a hora atual mostrando o que você deveria está estudando. Bem simples mesmo. Eu queria receber SMS com as informações, mas resolvi não mexer mais.

Kf5hqe0.png

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>

    GUICreate("CRONOGRAMA DE ESTUDOS", 800, 660)
    GUICtrlCreateLabel("Receber SMS:",665,475,140,20)
        GUICtrlSetState(-1,$GUI_DISABLE )
    $ddi =  GUICtrlCreateInput("55",665,500,25,20)
    GUICtrlSetState($ddi,$GUI_DISABLE )
    $tell=  GUICtrlCreateInput("",695,500,100,20)
    GUICtrlSetState($tell,$GUI_DISABLE )
    $itelCheck =GUICtrlCreateCheckbox("Receber Notificações",665,523,200,20)
    GUICtrlSetState($itelCheck,$GUI_DISABLE )
    Global $idListview = GUICtrlCreateListView("HORAS   |SEGUNDA|TERÇA|QUARTA|QUINTA|SEXTA|SABADO|DOMINGO", 10, 10, 630, 640, $LVS_SHOWSELALWAYS+$LVS_SINGLESEL,$LVS_EX_GRIDLINES+$LVS_EX_DOUBLEBUFFER+$LVS_EX_FULLROWSELECT+$WS_EX_CLIENTEDGE)
        GUICtrlSetState($idListview,$GUI_DISABLE )
    for $i=0 to 7
    _GUICtrlListView_JustifyColumn($idListview, $i, 2)
    Next

Global $Tempo
Global $att = True
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState(@SW_SHOW)


    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    Local $seg = @SEC, $min = @MIN, $Hora= @HOUR
    $iTime = $Hora  & ":" & $min
    Switch $iTime
        Case $ATT and $iTime >= "7:00" and $iTime <= "7:29"
            $Tempo = 0
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "7:30" and $iTime <= "7:59"
            $Tempo = 1
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "8:00" and $iTime <= "8:29"
            $Tempo = 2
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "8:30" and $iTime <= "8:59"
            $Tempo = 3
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "9:00" and $iTime <= "9:29"
            $Tempo = 4
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "9:30" and $iTime <= "9:59"
            $Tempo = 5
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "10:00" and $iTime <= "10:29"
            $Tempo = 6
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "10:30" and $iTime <= "10:59"
            $Tempo = 7
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "11:00" and $iTime <= "11:29"
            $Tempo = 8
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "11:30" and $iTime <= "11:59"
            $Tempo = 9
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "12:00" and $iTime <= "12:29"
            $Tempo = 10
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "12:30" and $iTime <= "12:59"
            $Tempo = 11
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "13:00" and $iTime <= "13:29"
            $Tempo = 12
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "13:30" and $iTime <= "13:59"
            $Tempo = 13
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "14:00" and $iTime <= "14:29"
            $Tempo = 14
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "14:30" and $iTime <= "14:59"
            $Tempo = 15
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "15:00" and $iTime <= "15:29"
            $Tempo = 16
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "15:30" and $iTime <= "15:59"
            $Tempo = 17
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "16:00" and $iTime <= "16:29"
            $Tempo = 18
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "16:30" and $iTime <= "16:59"
            $Tempo = 19
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "17:00" and $iTime <= "17:29"
            $Tempo = 20
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "17:30" and $iTime <= "17:59"
            $Tempo = 21
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "18:00" and $iTime <= "18:29"
            $Tempo = 22
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "18:30" and $iTime <= "18:59"
            $Tempo = 23
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "19:00" and $iTime <= "19:29"
            $Tempo = 24
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "19:30" and $iTime <= "19:59"
            $Tempo = 25
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "20:00" and $iTime <= "20:29"
            $Tempo = 26
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "20:30" and $iTime <= "20:59"
            $Tempo = 27
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "21:00" and $iTime <= "21:29"
            $Tempo = 28
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "21:30" and $iTime <= "21:59"
            $Tempo = 29
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "22:00" and $iTime <= "22:29"
            $Tempo = 30
            $ATT = False
            _drawItens()
        Case $ATT and $iTime >= "22:30" and $iTime <= "22:59"
            $Tempo = 31
            $ATT = False
            _drawItens()
        Case $min & ":" & $seg = "00:00" or $min & ":" & $seg = "30:00"
            $ATT = True
    EndSwitch

    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete()


Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
     Local $tNMHDR, $hWndFrom, $iCode,$hListView
     $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
     $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
     $iCode = DllStructGetData($tNMHDR, "Code")
     $hListView = GuiCtrlGetHandle($idListview)

    Switch $hWndFrom
         Case $hListView
             Switch $iCode
               Case $NM_CUSTOMDRAW
                     Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
                     Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage")
                     If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW
                     If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW
                     Local $iSubItem = DllStructGetData($tCustDraw, "iSubItem")
                     Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec")
                     Local $iColor, $iColor2



                        If $iItem = $Tempo Then
                                If $iSubItem = @WDAY-1 Then
                                    $iColor = RGB2BGR(0x00aa00)  ; green
                                Else
                                    $iColor = RGB2BGR(0x26FF26)  ; pink
                                EndIf
                        Else
                            if $iItem = 5 and $iSubItem >= 1 and  $iSubItem < 6 Then
                                $iColor = RGB2BGR(0x5B9BD5)  ; azul escuro
                            ElseIf $iItem = 2 or $iItem = 3 or $iItem = 4 and ($iSubItem >= 6) Then
                                #DEEAF6
                                $iColor = RGB2BGR(0xDEEAF6)  ; blue
                            ElseIf $iItem = 12 and ($iSubItem = 1 or $iSubItem = 3 or $iSubItem = 5) Then
                                $iColor = RGB2BGR(0x5B9BD5)  ; blue
                            ElseIf $iItem = 13 and ($iSubItem >= 1 And $iSubItem <= 8) Then
                                $iColor = RGB2BGR(0x5B9BD5)  ; blue
                            ElseIf $iItem = 14 or $iItem = 15 and ($iSubItem = 1 or $iSubItem >= 5) Then
                                $iColor = RGB2BGR(0xFF0000)  ; red
                            ElseIf $iItem = 16 and ($iSubItem = 1 or $iSubItem = 5) Then
                                $iColor = RGB2BGR(0xffaaff)  ; pink
                            ElseIf $iItem = 17 or $iItem = 18 and $iSubItem >= 1 And $iSubItem < 6 Then
                                $iColor = RGB2BGR(0xffaaff)  ; pink
                            ElseIf $iItem = 22 and ($iSubItem >= 1 And $iSubItem <= 5) Then
                                $iColor = RGB2BGR(0xFF0000)  ; red
                            ElseIf $iItem = 23 and ($iSubItem = 1 or $iSubItem = 5) Then
                                $iColor = RGB2BGR(0xFF0000)  ; red
                            ElseIf $iItem = 23 and ($iSubItem >= 2 and $iSubItem < 5) Then
                                $iColor = RGB2BGR(0xFFC000)  ; amarelo
                            ElseIf $iItem = 24 and ($iSubItem >= 1 and $iSubItem < 6) Then
                                $iColor = RGB2BGR(0xFFC000)  ; amarelo
                            ElseIf $iItem = 25 and ($iSubItem >= 1 and $iSubItem < 6) Then
                                $iColor = RGB2BGR(0xFFC000)  ; amarelo
                            ElseIf $iItem = 29 or $iItem = 30 and ($iSubItem >= 1 and $iSubItem < 6) Then
                                $iColor = RGB2BGR(0xDEEAF6)  ; azul claro
                            ElseIf $iItem = 31 and ($iSubItem >= 1 and $iSubItem < 6) Then
                                $iColor = RGB2BGR(0x5B9BD5)  ; azul escuro
                            Else
                                $iColor = RGB2BGR(0xFFFFFF)  ; white
                            EndIf
                        EndIf

                     DllStructSetData($tCustDraw, "clrTextBk", $iColor) ; background color
                     Return $CDRF_NEWFONT
             EndSwitch
     EndSwitch
    Return $GUI_RUNDEFMSG
 EndFunc   ;==>WM_NOTIFY

Func RGB2BGR($iColor)
     Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF)
EndFunc   ;==>RGB2BGR()


Func _drawItens()
_GUICtrlListView_DeleteAllItems ( $idListview )
GUICtrlCreateListViewItem("7h - 7h30", $idListview)
GUICtrlCreateListViewItem("7h30 - 8h", $idListview)
GUICtrlCreateListViewItem("8h - 8h30|HISTÓRIA| MATEMÁTICA|    LITERATURA| BIOLOGIA|   FÍSICA", $idListview)
GUICtrlCreateListViewItem("8h30 - 9h|HISTÓRIA| MATEMÁTICA|    LITERATURA| BIOLOGIA|   FÍSICA", $idListview)
GUICtrlCreateListViewItem("9h - 9h30|HISTÓRIA| MATEMÁTICA|    LITERATURA| BIOLOGIA|   FÍSICA", $idListview)
GUICtrlCreateListViewItem("9h30 - 10h", $idListview)
GUICtrlCreateListViewItem("10h - 10h30|QUÍMICA|    GEOGRAFIA|  FÍSICA|    FIL/SOC |HISTÓRIA", $idListview)
GUICtrlCreateListViewItem("10h30 - 11h|QUÍMICA|    GEOGRAFIA|  FÍSICA|    FIL/SOC |HISTÓRIA", $idListview)
GUICtrlCreateListViewItem("11h - 11h30|QUÍMICA|    GEOGRAFIA|  FÍSICA|    FIL/SOC |HISTÓRIA", $idListview)
GUICtrlCreateListViewItem("11h30 - 12h", $idListview)
GUICtrlCreateListViewItem("12h - 12h30", $idListview)
GUICtrlCreateListViewItem("12h30 - 13h", $idListview)
GUICtrlCreateListViewItem("13h - 13h30", $idListview)
GUICtrlCreateListViewItem("13h30 - 14h", $idListview)
GUICtrlCreateListViewItem("14h - 14h30||BIOLOGIA    |MATEMÁTICA    |QUÍMICA", $idListview)
GUICtrlCreateListViewItem("14h30 - 15h||BIOLOGIA    |MATEMÁTICA    |QUÍMICA", $idListview)
GUICtrlCreateListViewItem("15h - 15h30||BIOLOGIA    |MATEMÁTICA    |QUÍMICA", $idListview)
GUICtrlCreateListViewItem("15h30 - 16h", $idListview)
GUICtrlCreateListViewItem("16h - 16h30", $idListview)
GUICtrlCreateListViewItem("16h30 - 17h|REDAÇÃO    |LITERATURA |HISTÓRIA  |QUÍMICA   |REDAÇÃO", $idListview)
GUICtrlCreateListViewItem("17h - 17h30|REDAÇÃO    |LITERATURA |HISTÓRIA  |QUÍMICA   |REDAÇÃO", $idListview)
GUICtrlCreateListViewItem("17h30 - 18h|REDAÇÃO    |LITERATURA |HISTÓRIA  |QUÍMICA   |REDAÇÃO", $idListview)
GUICtrlCreateListViewItem("18h - 18h30", $idListview)
GUICtrlCreateListViewItem("18h30 - 19h", $idListview)
GUICtrlCreateListViewItem("19h - 19h30", $idListview)
GUICtrlCreateListViewItem("19h30 - 20h", $idListview)
GUICtrlCreateListViewItem("20h - 20h30", $idListview)
GUICtrlCreateListViewItem("20h30 - 21h", $idListview)
GUICtrlCreateListViewItem("21h - 21h30", $idListview)
GUICtrlCreateListViewItem("21h30 - 22h", $idListview)
GUICtrlCreateListViewItem("22h - 22h30", $idListview)
GUICtrlCreateListViewItem("22h30 - 23h", $idListview)
Sleep(1000)
EndFunc

 

 

Edited by Pedro Pinheiro
  • Thanks 1

Share this post


Link to post
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


×