Sign in to follow this  
Followers 0
Golbez

help plz...

5 posts in this topic

how do i get the information the person selects in the group?

Opt('GUIONEVENTMODE', 1)
#include <Date.au3>
#include <GUIConstants.au3>
    
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, $iCHK, $iPid, $iCTime, $closescript, $playscript

_MainGUI()

Func _MainGUI()
    $Main = GUICreate("Golbez Alarm", 274, 218, 352, 257, 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, 176, 73, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetCursor ($Button1, 7)
        GUICtrlSetOnEvent(-1, "Terminate")
    $Button2 = GUICtrlCreateButton("Setup", 192, 136, 73, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUISetOnEvent(-3, 'Terminate')
        GUICtrlSetOnEvent($Button2, '_MAINEVENTS')
        GUISetState()
    $Button3 = GUICtrlCreateButton("Play", 144, 136, 41, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays current song.")
        GUICtrlSetOnEvent(-1, "Play")
    $Button4 = GUICtrlCreateButton("Stop", 144, 176, 41, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Stops current song.")
        GUICtrlSetOnEvent(-1, "Stop")
    $Button9 = GUICtrlCreateButton("Previous", 8, 176, 65, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays previous song.")
        GUICtrlSetOnEvent(-1, "_Previous")
    $Button10 = GUICtrlCreateButton("Next", 8, 136, 65, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays next song.")
        GUICtrlSetOnEvent(-1, "_Next")
    $Button11 = GUICtrlCreateButton("Vol Up", 80, 136, 57, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Turn volume up.")
        GUICtrlSetOnEvent(-1, "VolUp")
    $Button12 = GUICtrlCreateButton("Vol Dn", 80, 176, 57, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Turn volume down.")
        GUICtrlSetOnEvent(-1, "VolDown")
    $Button13 = GUICtrlCreateButton("Snooze", 120, 8, 145, 41, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $SleepHour = GUICtrlCreateCombo("Hour", 24, 64, 49, 25)
        GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $SleepMinutes = GUICtrlCreateCombo("Minutes", 72, 64, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $SleepSeconds = GUICtrlCreateCombo("Seconds", 136, 64, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $SleepTime = GUICtrlCreateCombo("Time", 208, 64, 49, 25)
        GUICtrlSetData(-1, "AM|PM")
    $WakeHour = GUICtrlCreateCombo("Hour", 26, 104, 49, 25)
        GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $WakeMinutes = GUICtrlCreateCombo("Minutes", 74, 104, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $WakeSeconds = GUICtrlCreateCombo("Seconds", 138, 104, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $WakeTime = GUICtrlCreateCombo("Time", 210, 104, 49, 25)
        GUICtrlSetData(-1, "AM|PM")
    $Group1 = GUICtrlCreateGroup("Sleep Time", 16, 48, 249, 41)
        GUICtrlSetBkColor(-1, 0xA0A0A4)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("Wake Up Time", 16, 88, 249, 41)
        GUICtrlSetBkColor(-1, 0xA0A0A4)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Main)
    While 1
        Sleep(1000)
        _AdlibManager()
    WEnd
EndFunc

is it somethin like.

If $SleepTime = 2 then

<do something here>

EndIf

Share this post


Link to post
Share on other sites



Hi,

sorry your script doesn't work. Why aren't you posting a script that shows the problem?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i no it didnt work.. it shouldnt. its not a whole code.

im just wondering how the "GUICtrlCreateCombo" works.

heres full code.

Opt('GUIONEVENTMODE', 1)
#include <Date.au3>
#include <GUIConstants.au3>
    
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, $iCHK, $iPid, $iCTime, $closescript, $playscript
Global $SleepHour, $SleepMinutes, $SleepTime, $SleepSeconds, $WakeHour, $WakeMinutes, $WakeSeconds, $WakeTime

_MainGUI()

Func _MainGUI()
    $Main = GUICreate("Golbez Alarm", 274, 218, 352, 257, 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, 176, 73, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetCursor ($Button1, 7)
        GUICtrlSetOnEvent(-1, "Terminate")
    $Button2 = GUICtrlCreateButton("Setup", 192, 136, 73, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUISetOnEvent(-3, 'Terminate')
        GUICtrlSetOnEvent($Button2, '_MAINEVENTS')
        GUISetState()
    $Button3 = GUICtrlCreateButton("Play", 144, 136, 41, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays current song.")
        GUICtrlSetOnEvent(-1, "Play")
    $Button4 = GUICtrlCreateButton("Stop", 144, 176, 41, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Stops current song.")
        GUICtrlSetOnEvent(-1, "Stop")
    $Button9 = GUICtrlCreateButton("Previous", 8, 176, 65, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays previous song.")
        GUICtrlSetOnEvent(-1, "_Previous")
    $Button10 = GUICtrlCreateButton("Next", 8, 136, 65, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Plays next song.")
        GUICtrlSetOnEvent(-1, "_Next")
    $Button11 = GUICtrlCreateButton("Vol Up", 80, 136, 57, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Turn volume up.")
        GUICtrlSetOnEvent(-1, "VolUp")
    $Button12 = GUICtrlCreateButton("Vol Dn", 80, 176, 57, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlSetTip(-1, "Turn volume down.")
        GUICtrlSetOnEvent(-1, "VolDown")
    $Button13 = GUICtrlCreateButton("Snooze", 120, 8, 145, 41, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $SleepHour = GUICtrlCreateCombo("Hour", 24, 64, 49, 25)
        GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $SleepMinutes = GUICtrlCreateCombo("Minutes", 72, 64, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $SleepSeconds = GUICtrlCreateCombo("Seconds", 136, 64, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $SleepTime = GUICtrlCreateCombo("Time", 208, 64, 49, 25)
        GUICtrlSetData(-1, "AM|PM")
    $WakeHour = GUICtrlCreateCombo("Hour", 26, 104, 49, 25)
        GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $WakeMinutes = GUICtrlCreateCombo("Minutes", 74, 104, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $WakeSeconds = GUICtrlCreateCombo("Seconds", 138, 104, 65, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|
33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $WakeTime = GUICtrlCreateCombo("Time", 210, 104, 49, 25)
        GUICtrlSetData(-1, "AM|PM")
    $Group1 = GUICtrlCreateGroup("Sleep Time", 16, 48, 249, 41)
        GUICtrlSetBkColor(-1, 0xA0A0A4)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("Wake Up Time", 16, 88, 249, 41)
        GUICtrlSetBkColor(-1, 0xA0A0A4)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Main)
    While 1
        Sleep(1000)
        _AdlibManager()
    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($SleepHour)) And @MIN = GUICtrlRead($SleepMinutes) And _
        $AMPM = GUICtrlRead($SleepTime) 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", 273, 217, 353, 257)
        GUISetFont(8, 400, 0, "Comic Sans MS")
    $Label1 = GUICtrlCreateLabel("", 24, 0, 4, 4)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Button21 = GUICtrlCreateButton("Back to Main Menu", 128, 176, 129, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Button1 = GUICtrlCreateButton("Accept", 16, 176, 81, 33, 0)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $TabMenu = GUICtrlCreateTab(0, 8, 265, 161)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $TabSheet1 = GUICtrlCreateTabItem("Other")
    $Group1 = GUICtrlCreateGroup("Snooze Time", 8, 51, 97, 47, $BS_CENTER)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Checkbox1 = GUICtrlCreateCheckbox("Close Winamp after alarm is triggered", 8, 107, 241, 17)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Checkbox2 = GUICtrlCreateCheckbox("Close Alarm after alarm is triggered", 8, 139, 233, 17)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $SnoozeTime = GUICtrlCreateCombo("", 16, 67, 81, 25)
        GUICtrlSetData(-1, "05 Minutes|10 Minutes|15 Minutes|20 Minutes|25 Minutes|30 Minutes")
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $TabSheet2 = GUICtrlCreateTabItem("Keystrokes")
    $TabSheet3 = GUICtrlCreateTabItem("")
    $TabSheet4 = GUICtrlCreateTabItem("")
    $TabSheet5 = GUICtrlCreateTabItem("About")
        GUICtrlSetState(-1,$GUI_SHOW)
    $Label3 = GUICtrlCreateLabel("Made By: Ray Smith", 140, 41, 106, 19, $SS_CENTER)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label2 = GUICtrlCreateLabel("Thanks", 148, 58, 40, 19, $SS_CENTER)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label4 = GUICtrlCreateLabel("Smoke", 160, 76, 38, 19)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label5 = GUICtrlCreateLabel("Prodigy", 160, 92, 43, 19)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label6 = GUICtrlCreateLabel("BB_HIT_MAN", 160, 108, 80, 19)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label7 = GUICtrlCreateLabel("Version:  1.04", 174, 138, 74, 19)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Pic1 = GUICtrlCreatePic("Pic1.gif", 0, 40, 140, 114, 0, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetState(-1, $GUI_DISABLE)
        GUICtrlCreateTabItem("")
    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 SleepTime()
    Stop()
;If $closewinamp = 1 then 
    If $closescript = 1 Then Terminate()
EndFunc
Func PlayTime()
    Play()
;If $playwinamp = 1 then 
    If $playscript = 1 Then Terminate()
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 Terminate()
    Exit
EndFunc
Edited by Golbez

Share this post


Link to post
Share on other sites

HI,

try this chose something and then press VolumeDown:

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

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, $iCHK, $iPid, $iCTime, $closescript, $playscript
Global $sleephour, $SleepMinutes, $SleepTime, $SleepSeconds, $WakeHour, $WakeMinutes, $WakeSeconds, $WakeTime

_MainGUI()

Func _MainGUI()
    $main = GUICreate("Golbez Alarm", 274, 218, 352, 257, 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, 176, 73, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetCursor($Button1, 7)
    GUICtrlSetOnEvent(-1, "Terminate")
    $Button2 = GUICtrlCreateButton("Setup", 192, 136, 73, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUISetOnEvent(-3, 'Terminate')
    GUICtrlSetOnEvent($Button2, '_MAINEVENTS')
    GUISetState()
    $Button3 = GUICtrlCreateButton("Play", 144, 136, 41, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetTip(-1, "Plays current song.")
    GUICtrlSetOnEvent(-1, "Play")
    $Button4 = GUICtrlCreateButton("Stop", 144, 176, 41, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetTip(-1, "Stops current song.")
    GUICtrlSetOnEvent(-1, "Stop")
    $Button9 = GUICtrlCreateButton("Previous", 8, 176, 65, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetTip(-1, "Plays previous song.")
    GUICtrlSetOnEvent(-1, "_Previous")
    $Button10 = GUICtrlCreateButton("Next", 8, 136, 65, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetTip(-1, "Plays next song.")
    GUICtrlSetOnEvent(-1, "_Next")
    $Button11 = GUICtrlCreateButton("Vol Up", 80, 136, 57, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetTip(-1, "Turn volume up.")
    GUICtrlSetOnEvent(-1, "VolUp")
    $Button12 = GUICtrlCreateButton("Vol Dn", 80, 176, 57, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlSetTip(-1, "Turn volume down.")
    GUICtrlSetOnEvent(-1, "VolDown")
    $Button13 = GUICtrlCreateButton("Snooze", 120, 8, 145, 41, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $sleephour = GUICtrlCreateCombo("Hour", 24, 64, 49, 25)
    GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $SleepMinutes = GUICtrlCreateCombo("Minutes", 72, 64, 65, 25)
    GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $SleepSeconds = GUICtrlCreateCombo("Seconds", 136, 64, 65, 25)
    GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $SleepTime = GUICtrlCreateCombo("Time", 208, 64, 49, 25)
    GUICtrlSetData(-1, "AM|PM")
    $WakeHour = GUICtrlCreateCombo("Hour", 26, 104, 49, 25)
    GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $WakeMinutes = GUICtrlCreateCombo("Minutes", 74, 104, 65, 25)
    GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $WakeSeconds = GUICtrlCreateCombo("Seconds", 138, 104, 65, 25)
    GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60")
    $WakeTime = GUICtrlCreateCombo("Time", 210, 104, 49, 25)
    GUICtrlSetData(-1, "AM|PM")
    $Group1 = GUICtrlCreateGroup("Sleep Time", 16, 48, 249, 41)
    GUICtrlSetBkColor(-1, 0xA0A0A4)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("Wake Up Time", 16, 88, 249, 41)
    GUICtrlSetBkColor(-1, 0xA0A0A4)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $main)
    While 1
        Sleep(1000)
        _AdlibManager()
    WEnd
EndFunc   ;==>_MainGUI
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($sleephour)) And @MIN = GUICtrlRead($SleepMinutes) And _
            $AMPM = GUICtrlRead($SleepTime) 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   ;==>_AdlibManager
Func _MAINEVENTS()
    Switch @GUI_CtrlId
        Case $Button2
            GUISetState(@SW_HIDE, HWnd($main))
            Opt('GUIONEVENTMODE', _SetupGUI())
            GUISetState(@SW_SHOW, HWnd($main))
    EndSwitch
EndFunc   ;==>_MAINEVENTS
Func _SetupGUI()
    $OptGOEM = Opt('GUIONEVENTMODE', 0)
    $Setup = GUICreate("Setup", 273, 217, 353, 257)
    GUISetFont(8, 400, 0, "Comic Sans MS")
    $Label1 = GUICtrlCreateLabel("", 24, 0, 4, 4)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Button21 = GUICtrlCreateButton("Back to Main Menu", 128, 176, 129, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Button1 = GUICtrlCreateButton("Accept", 16, 176, 81, 33, 0)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $TabMenu = GUICtrlCreateTab(0, 8, 265, 161)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $TabSheet1 = GUICtrlCreateTabItem("Other")
    $Group1 = GUICtrlCreateGroup("Snooze Time", 8, 51, 97, 47, $BS_CENTER)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Checkbox1 = GUICtrlCreateCheckbox("Close Winamp after alarm is triggered", 8, 107, 241, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Checkbox2 = GUICtrlCreateCheckbox("Close Alarm after alarm is triggered", 8, 139, 233, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $SnoozeTime = GUICtrlCreateCombo("", 16, 67, 81, 25)
    GUICtrlSetData(-1, "05 Minutes|10 Minutes|15 Minutes|20 Minutes|25 Minutes|30 Minutes")
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $TabSheet2 = GUICtrlCreateTabItem("Keystrokes")
    $TabSheet3 = GUICtrlCreateTabItem("")
    $TabSheet4 = GUICtrlCreateTabItem("")
    $TabSheet5 = GUICtrlCreateTabItem("About")
    GUICtrlSetState(-1, $GUI_SHOW)
    $Label3 = GUICtrlCreateLabel("Made By: Ray Smith", 140, 41, 106, 19, $SS_CENTER)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label2 = GUICtrlCreateLabel("Thanks", 148, 58, 40, 19, $SS_CENTER)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label4 = GUICtrlCreateLabel("Smoke", 160, 76, 38, 19)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label5 = GUICtrlCreateLabel("Prodigy", 160, 92, 43, 19)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label6 = GUICtrlCreateLabel("BB_HIT_MAN", 160, 108, 80, 19)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Label7 = GUICtrlCreateLabel("Version:  1.04", 174, 138, 74, 19)
    GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Pic1 = GUICtrlCreatePic("Pic1.gif", 0, 40, 140, 114, 0, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    While 1
        Switch GUIGetMsg()
            Case - 3
                GUIDelete(HWnd($Setup))
                Return $OptGOEM
            Case $Button21
                GUIDelete(HWnd($Setup))
                Return $OptGOEM
        EndSwitch
    WEnd
EndFunc   ;==>_SetupGUI
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   ;==>_iniread
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   ;==>_GetHour
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   ;==>_SwitchHour
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   ;==>GetTime
Func SleepTime()
    Stop()
    ;If $closewinamp = 1 then
    If $closescript = 1 Then Terminate()
EndFunc   ;==>SleepTime
Func PlayTime()
    Play()
    ;If $playwinamp = 1 then
    If $playscript = 1 Then Terminate()
EndFunc   ;==>PlayTime
Func Play()
    Send($play)
EndFunc   ;==>Play
Func Stop()
    Send($stop)
EndFunc   ;==>Stop
Func VolUp()
    Send($volup)
EndFunc   ;==>VolUp
Func VolDown()
    Send($voldn)
    MsgBox(0,"", GUICtrlRead($sleephour))
EndFunc   ;==>VolDown
Func _Next()
    Send($next)
EndFunc   ;==>_Next
Func _Previous()
    Send($previous)
EndFunc   ;==>_Previous
Func Terminate()
    Exit
EndFunc   ;==>Terminate

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Global $AMPM
$Main = GUICreate('example', 220, 100)
GUICtrlCreateLabel('Hour:', 10, 15, 40, 20)
$Hour = GUICtrlCreateCombo('', 45, 10, 40, 150)
GUICtrlCreateLabel('Min:', 90, 15, 40, 20)
$Min = GUICtrlCreateCombo('', 115, 10, 40, 150)
GUICtrlSetData($Hour, _FillHourCombo())
GUICtrlSetData($Min, _FillMinCombo())
$DayNight = GUICtrlCreateCombo('', 165, 10, 40, 150)
GUICtrlSetData($DayNight, 'AM|PM|')
$button = GUICtrlCreateButton('Example', 80, 50, 60, 30)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $button
            $nCurrentHour = _GetHour(@HOUR)
            $nCurrentMin = @MIN
            $nSetHour = GUICtrlRead($Hour)
            $nSetMin = GUICtrlRead($Min)
            $sAMPM = GUICtrlRead($DayNight)
            MsgBox(64, 'Info', 'Alarm is set for: ' & _
                'Current Time: ' & $nCurrentHour & ':' & $nCurrentMin & ' ' & $AMPM & @CR & _
                'Time Alarm is Set: ' & $nSetHour & ':' & $nSetMin & ' ' & $sAMPM)
    EndSwitch
WEnd

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 _FillHourCombo()
    Local $sHold
    For $iCC = 1 To 12
        $sHold &= $iCC & '|'
    Next
    Return $sHold
EndFunc

Func _FillMinCombo()
    Local $sHold
    For $iCC = 1 To 59; Not 60
        $sHold &= StringFormat('%02d', $iCC) & '|'
    Next
    Return $sHold
EndFunc
See if that helps you on your way.


[center]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.[/center]

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  
Followers 0