Jump to content
Sign in to follow this  
Golbez

help.. time!

Recommended Posts

GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)

in this whats $ictime??

or do i got 2 set what it is or does this command set what it is.. ugh im so confused but i think im getten it.. i just relized that i think 2 do somethin with ictime but idk what yet

im tryen 2 get it 2 work in a seperate program..

this what im doen.

Global $iCTime, $AMPM, $iCombo, $iCHK, $iPid
#include <GUIConstants.au3>
_AdlibManager()
Func _Alarm()
GUICreate("My GUI"); will create a dialog box that when displayed is centered
GUICtrlCreateCombo ("", 10,10)
GUISetState ()   ; will display an empty dialog box with a combo control with focus on
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

EndFunc
 



Func _AdlibManager()
    Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':')
    If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _
        Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _
        GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)
   
    If @HOUR = _SwitchHour(GUICtrlRead($iCombo[1])) And @MIN = GUICtrlRead($iCombo[2]) And _
        $AMPM = GUICtrlRead($iCombo[3]) And BitAND(GUICtrlRead($iCHK[1]), 1) Then
        AdlibDisable()
        While BitAND(GUICtrlRead($iCHK[1]), 1)
            _Alarm()
            Sleep(500)
        WEnd
        ProcessClose($iPid)
        AdlibEnable('_AdlibManager', 100)
    EndIf
EndFunc
Func _GetHour($iHour)
    Switch $iHour
        Case 12
            $AMPM = 'PM'
            Return $iHour
        Case 13 To 23
            $AMPM = 'PM'
            Return $iHour - 12
        Case 0
            $AMPM = 'AM'
            Return 12
        Case 1 To 11
            $AMPM = 'AM'
            Return $iHour
    EndSwitch
EndFunc
Func _SwitchHour($iHour)
    Switch $iHour
        Case 12
            If $AMPM = 'AM' Then
                Return 0
            Else
                Return 12
            EndIf
        Case 1 To 11
            If $AMPM = 'PM' Then
                Return $iHour + 12
            Else
                Return $iHour
            EndIf
    EndSwitch
EndFunc

someone think that can tell me or help me how 2 do this.. im sooo lost.. and i dont understand how it puts it on the gui.. when i looked in the help menu that command is to make a list or combo list :) and im pretty sure thats not what i need.

Edited by Golbez

Share this post


Link to post
Share on other sites

$iCTime is the GUI label.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Nothing more to tell you, you either get it and go on, don't get it and quit, don't get it and keep trying, or someone writes it for you.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Func _AdlibManager()
    Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':')
    If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _
        Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _
        GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)
   
    If @HOUR = _SwitchHour(GUICtrlRead($iCombo[1])) And @MIN = GUICtrlRead($iCombo[2]) And _
        $AMPM = GUICtrlRead($iCombo[3]) And BitAND(GUICtrlRead($iCHK[1]), 1) Then
        AdlibDisable()
        While BitAND(GUICtrlRead($iCHK[1]), 1)
          ;_Alarm()
            Sleep(500)
        WEnd
        ProcessClose($iPid)
        AdlibEnable('_AdlibManager', 100)
    EndIf
EndFunc

ok this what im haven trouble with.. maybe u can tell me where 2 find out the info i need.

$aSplit[0] <-- its tellen me it is an "undefined function." but idk how 2 define it.. ive tried

Dim $aSplit[0], Global $aSplit[0], Dim $aSplit, Global $aSplit,

GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM) <--- i understand that this sets the data to the time n stuff bot i dont get how it puts it on the gui.. wouldnt i have to make somethin to put this data in?? i cant find anythin that i could do this with.

i really dont wanna give up.. i love doing this stuff and its pissen me off cause i cant figure it out :P

can u maybe give me an example program or somethin that i can read 2 learn what i got 2 do.. kinda like what u did with the other thing u told me and i had 2 add n take stuff out... thanx again smoke :)

Edited by Golbez

Share this post


Link to post
Share on other sites

This is the label I made:

Global $iCTime = GUICtrlCreateLabel('Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM _
                    , 10, 10, 120, 45, 0x01)
That's what StringSplit is splitting.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

thank you Mr. Smoke :)

OOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!

ok im a moron! im sorry i didnt see that. i read right over to create a label but didnt think of it. thank you!!

code update: :P

Opt('GUIONEVENTMODE', 1)
#include <Date.au3>
#include <GUIConstants.au3>

_iniread()
Global $sleephour, $sleepmin, $wakeuphour, $wakeupmin, $stop, $play, $voldn, $volup, $next, $previous, $Setup, $close, $main, $iHour, $AMPM
Global $Button1, $Button2, $Button21, $Button3, $Button4, $Button9, $Button10, $Button11, $Button12, $iCombo, $iCHK, $iPid, $iCTime
_MainGUI()

Func _MainGUI()
    $Main = GUICreate("Golbez Alarm", 273, 209, 356, 216, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
        GUISetBkColor(0xA0A0A4)
    $iCTime = GUICtrlCreateLabel('Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM _ 
        , 25, 10, 80, 37, 0x01, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    $Button1 = GUICtrlCreateButton("Exit", 192, 168, 73, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetCursor ($Button1, 7)
        GUICtrlSetOnEvent(-1, "Terminate")
    $Button2 = GUICtrlCreateButton("Setup", 192, 128, 73, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUISetOnEvent(-3, 'Terminate')
        GUICtrlSetOnEvent($Button2, '_MAINEVENTS')
        GUISetState()
    $Button3 = GUICtrlCreateButton("Play", 144, 128, 41, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays current song.")
        GUICtrlSetOnEvent(-1, "Play")
    $Button4 = GUICtrlCreateButton("Stop", 144, 168, 41, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Stops current song.")
        GUICtrlSetOnEvent(-1, "Stop")
    $Button5 = GUICtrlCreateButton("U", 200, 56, 25, 17, 0)
    $Button6 = GUICtrlCreateButton("U", 200, 88, 25, 17, 0)
    $Button7 = GUICtrlCreateButton("D", 240, 56, 25, 17, 0)
    $Button8 = GUICtrlCreateButton("D", 240, 88, 25, 17, 0)
    $Button9 = GUICtrlCreateButton("Previous", 8, 168, 65, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays previous song.")
        GUICtrlSetOnEvent(-1, "_Previous")
    $Button10 = GUICtrlCreateButton("Next", 8, 128, 65, 33)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays next song.")
        GUICtrlSetOnEvent(-1, "_Next")
    $Button11 = GUICtrlCreateButton("Vol Up", 80, 128, 57, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Turn volume up.")
        GUICtrlSetOnEvent(-1, "VolUp")
    $Button12 = GUICtrlCreateButton("Vol Dn", 80, 168, 57, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Turn volume down.")
        GUICtrlSetOnEvent(-1, "VolDown")
    GUICtrlCreateLabel("WakeUp time goes here", 16, 56, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
        GUICtrlSetBkColor(-1, 0xA0A0A4)
    GUICtrlCreateLabel("Sleep time goes here", 16, 88, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_RIGHTJUST))
        GUICtrlSetBkColor(-1, 0xA0A0A4)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Main)
    While 1
;_AdlibManager()
        Sleep(1000)
    WEnd
EndFunc

Func _AdlibManager()
    Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':')
    If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _
        Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _
        GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)
   
    If @HOUR = _SwitchHour(GUICtrlRead($iCombo[1])) And @MIN = GUICtrlRead($iCombo[2]) And _
        $AMPM = GUICtrlRead($iCombo[3]) And BitAND(GUICtrlRead($iCHK[1]), 1) Then
        AdlibDisable()
        While BitAND(GUICtrlRead($iCHK[1]), 1)
          ;_Alarm()
            Sleep(500)
        WEnd
        ProcessClose($iPid)
        AdlibEnable('_AdlibManager', 100)
    EndIf
EndFunc



Func _MAINEVENTS()
    Switch @GUI_CtrlId
        Case $Button2
            GUISetState(@SW_HIDE, HWnd($Main))
            Opt('GUIONEVENTMODE', _SetupGUI())
            GUISetState(@SW_SHOW, HWnd($Main))
    EndSwitch
EndFunc
Func _SetupGUI()
    $OptGOEM = Opt('GUIONEVENTMODE', 0)
    $Setup = GUICreate("Setup", 241, 161, 360, 216)
        GUISetFont(8, 400, 0, "Comic Sans MS")
        GUICtrlCreateLabel("", 32, 0, 4, 4)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Button21 = GUICtrlCreateButton("Back to Main Menu", 16, 120, 209, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUISetState(@SW_SHOW, $Setup)
    $Group1 = GUICtrlCreateGroup("Snooze Time", 16, 8, 97, 87, $BS_CENTER)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlCreateGroup("", -99, -99, 1, 1)
    $List1 = GUICtrlCreateList("", 24, 19, 81, 96, $WS_VSCROLL, $WS_EX_STATICEDGE)
        GUICtrlSetData(-1, "  5 Minutes|10 Minutes|15 Minutes|20 Minutes|25 Minutes|30 Minutes")
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Checkbox1 = GUICtrlCreateCheckbox("Close Winamp after sleep alarm is triggered", 8, 96, 225, 17)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUISetState(@SW_SHOW)
    While 1
        Switch GUIGetMsg()
            Case - 3
                GUIDelete(HWnd($Setup))
                Return $OptGOEM
            Case $Button21
                GUIDelete(HWnd($Setup))
                Return $OptGOEM
        EndSwitch
    WEnd
EndFunc
Func _iniread()
;Other
        $timekey = "{del}"
        $endkey = "{end}"
        HotKeySet($endkey, "Terminate")
        HotKeySet($timekey, "GetTime")
;Time
        $sleephour = 17
        $sleepmin = 29
        $wakeuphour = 17
        $wakeupmin = 30
        $day = 0
        $month = 0
        
;Delays
        $sleep = 10
;Keys
        $play = "^!{ins}"
        $stop = "^!{end}"
        $pause = "^!{home}"
        $volup = "^!{up}"
        $voldn = "^!{down}"
        $next = "^!{left}"
        $previous = "^!{right}"
EndFunc
Func _GetHour($iHour)
    Switch $iHour
        Case 12
            $AMPM = 'PM'
            Return $iHour
        Case 13 To 23
            $AMPM = 'PM'
            Return $iHour - 12
        Case 0
            $AMPM = 'AM'
            Return 12
        Case 1 To 11
            $AMPM = 'AM'
            Return $iHour
    EndSwitch
EndFunc
Func _SwitchHour($iHour)
    Switch $iHour
        Case 12
            If $AMPM = 'AM' Then
                Return 0
            Else
                Return 12
            EndIf
        Case 1 To 11
            If $AMPM = 'PM' Then
                Return $iHour + 12
            Else
                Return $iHour
            EndIf
    EndSwitch
EndFunc
Func GetTime()
    MsgBox(48,"time", "hour is: " & @HOUR & " min is: " & @MIN & " sec is: " & @SEC, 5)
    MsgBox(48,"date", "month is: " & @MON & " day is: " & @WDAY & " year is: " & @YEAR, 5)
EndFunc
Func Play()
    Send($play)
EndFunc
Func Stop()
    Send($stop)
EndFunc
Func VolUp()
    Send($volup)
EndFunc
Func VolDown()
    Send($voldn)
EndFunc
Func _Next()
    Send($next)
EndFunc
Func _Previous()
    Send($previous)
EndFunc
Func CloseSetup()
    GUIDelete($Setup)
EndFunc 
Func Terminate()
    Exit
EndFunc

arg.... now to find out how to get it to update!! i got the code to do it (thanks to smoke) now to get it to work

Edited by Golbez

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...