Jump to content

i need alil help!


 Share

Recommended Posts

some questions

#1 well in the setup there is 2 checkboxs. i can not figure out how 2 make it so if the user checks the box then leaves the setup. (the info from the check box is sent to the ini). if the user gos back into the ini i want to make it to the checkbox is checked again. ive looked in the help file and in the search but i cant not find anythin.

#2 in the setup under the about tab how do i make it so if there is a picture there, how do i make it so the picture has a transparent background. i have the pic all ready but it does not work.

#3 how do i make it do if someone change stuff in the setup thats the accept button will light up and if nothing is changed it will be grey.

#4 yeah about thos keystrokes. i want 2 make a input box that when the user clicks there, then click/holds a series of keys that they will be placed in the input box.

also if anyone sees any other stuff i should add leave a post :lmao:

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

Global $stop, $play, $voldn, $volup, $next, $previous, $Setup, $close, $main, $iHour, $AMPM, $sleep, $pause, $closewinamp, $closescript, $Checkbox1
Global $Button1, $Button2, $Button21, $Button3, $Button4, $Button9, $Button10, $Button11, $Button12, $iCHK, $iPid, $iCTime, $closescript, $playscript
Global $SleepHour, $SleepMinutes, $SleepTime, $SleepSeconds, $WakeHour, $WakeMinutes, $WakeSeconds, $WakeTime, $Checkbox2, $winampdir

_MainGUI()

Func _MainGUI()
    _iniread()
    $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)
        GUISetIcon ("bin\pic2.ico")
    $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")
        GUICtrlSetTip(-1, "Pauses alarm for: " & $sleep / 1000 & " minutes.")
        GUICtrlSetOnEvent(-1, "_Snooze")
    $SleepHour = GUICtrlCreateCombo("Hour", 24, 64, 49, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12")
    $SleepMinutes = GUICtrlCreateCombo("Minutes", 72, 64, 65, 25)
        GUICtrlSetData(-1, "00|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")
    $SleepSeconds = GUICtrlCreateCombo("Seconds", 136, 64, 65, 25)
        GUICtrlSetData(-1, "00|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")
    $SleepTime = GUICtrlCreateCombo("Time", 208, 64, 49, 25)
        GUICtrlSetData(-1, "AM|PM")
    $WakeHour = GUICtrlCreateCombo("Hour", 26, 104, 49, 25)
        GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12")
    $WakeMinutes = GUICtrlCreateCombo("Minutes", 74, 104, 65, 25)
        GUICtrlSetData(-1, "00|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")
    $WakeSeconds = GUICtrlCreateCombo("Seconds", 138, 104, 65, 25)
        GUICtrlSetData(-1, "00|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")
    $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 @SEC = GUICtrlRead($SleepSeconds) Then; And BitAND(GUICtrlRead($iCHK[1]), 1) Then
        AdlibDisable()
        SleepTime()
        Sleep(500)
        ProcessClose($iPid)
        AdlibEnable('_AdlibManager', 100)
    EndIf
    If @HOUR = _SwitchHour(GUICtrlRead($WakeHour)) And @MIN = GUICtrlRead($WakeMinutes) And _
        $AMPM = GUICtrlRead($WakeTime) And @SEC = GUICtrlRead($WakeSeconds) Then; And BitAND(GUICtrlRead($iCHK[1]), 1) Then
        AdlibDisable()
        PlayTime()
        Sleep(500)
        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()
    _iniread()
    $OptGOEM = Opt('GUIONEVENTMODE', 0)
    $Setup = GUICreate("Setup", 273, 217, 353, 257)
        GUISetFont(8, 400, 0, "Comic Sans MS")
        GUISetIcon ("bin\pic2.ico")
    $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")
        If $closewinamp = 1 then GUICtrlSetData($Checkbox1, 1)
    $Checkbox2 = GUICtrlCreateCheckbox("Close Alarm after alarm is triggered", 8, 139, 233, 17)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        If $closescript = 1 then GUICtrlSetData($Checkbox2, 1)
    $SnoozeTime = GUICtrlCreateCombo("Minutes", 16, 67, 81, 25)
        GUICtrlSetData(-1, "05|10|15|20|25|30")
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
        If $sleep <> 0 then GUICtrlSetData($SnoozeTime, $sleep / 1000)
    $Button4 = GUICtrlCreateButton("Open Winamp", 120, 48, 129, 49, 0)
        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.0.1", 170, 135, 90,19)
        GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
    $Pic1 = GUICtrlCreatePic("bin\Pic1.gif", 0, 40, 140, 114, 0, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetState(-1, $GUI_DISABLE)
        GUICtrlCreateTabItem("")
        $playk = "^!{ins}"
        $stopk = "^!{end}"
        $pausek = "^!{home}"
        $volupk = "^!{up}"
        $voldnk = "^!{down}"
        $nextk = "^!{left}"
        $previousk = "^!{right}"
        $snoozek = "" ;"{space}"
    GUISetState(@SW_SHOW)
    While 1
        Switch GUIGetMsg()
            Case - 3
                GUIDelete(HWnd($Setup))
                Return $OptGOEM
            Case $Button21
                GUIDelete(HWnd($Setup))
                Return $OptGOEM
            Case $Button4
                Run($winampdir & "\winamp.exe")
            Case $Button1 
                IniWrite("bin\alarm.ini", "time", "sleep", GUICtrlRead($SnoozeTime) * 1000)
                IniWrite("bin\alarm.ini", "other", "closewinamp", GUICtrlRead($CheckBox1))
                IniWrite("bin\alarm.ini", "other", "closescript", GUICtrlRead($CheckBox2))
                IniWrite("bin\alarm.ini", "hotkeys", "play", $playk)
                IniWrite("bin\alarm.ini", "hotkeys", "stop", $stopk)
                IniWrite("bin\alarm.ini", "hotkeys", "pause", $pausek)
                IniWrite("bin\alarm.ini", "hotkeys", "volup", $volupk)
                IniWrite("bin\alarm.ini", "hotkeys", "voldn", $voldnk)
                IniWrite("bin\alarm.ini", "hotkeys", "next", $nextk)
                IniWrite("bin\alarm.ini", "hotkeys", "previous", $previousk)
                IniWrite("bin\alarm.ini", "hotkeys", "snooze", $snoozek)
        EndSwitch
    WEnd
EndFunc
Func _iniread()
;Other
    $endkey = "{end}"
    $winampdir =  IniRead ("bin\alarm.ini", "other", "winampdir", "")
    $closewinamp = IniRead ("bin\alarm.ini", "other", "closewinamp", "4")
    $closescript = IniRead ("alarm.ini", "other", "closescript", "4")
;Delays
    $sleep = IniRead ("bin\alarm.ini", "time", "sleep", "00")
    
;Keys
    $play = IniRead ("bin\alarm.ini", "hotkeys", "play", "^!{ins}")
    $stop = IniRead ("bin\alarm.ini", "hotkeys", "stop", "^!{end}")
    $pause = IniRead ("bin\alarm.ini", "hotkeys", "pause", "^!{home}")
    $volup = IniRead ("bin\alarm.ini", "hotkeys", "volup", "^!{up}")
    $voldn = IniRead ("bin\alarm.ini", "hotkeys", "voldn", "^!{down}")
    $next = IniRead ("bin\alarm.ini", "hotkeys", "next", "^!{left}")
    $previous = IniRead ("bin\alarm.ini", "hotkeys", "previous", "^!{right}")
    $snoozekey = IniRead ("bin\alarm.ini", "hotkeys", "snooze", "{space}")
    
        HotKeySet($snoozekey, "_Snooze")
        HotKeySet($endkey, "Terminate")
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 _Snooze()
    send($pause)
    Sleep($sleep)
    PlayTime()
EndFunc
Func SleepTime();
    Stop()
   ;If $closewinamp = 1 then 
    If $closescript = 1 Then Terminate()
EndFunc
Func PlayTime();
    Play()
   ;If $closewinamp = 1 then 
    If $closescript = 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
Link to comment
Share on other sites

#1: Have a iniread to set the state of the checkbox. Something like this:

if iniread("file.ini", "section", "key", "") = "data" then guictrlsetstate($checkbox, $GUI_CHECKED)

#2 - GUICtrlCreatePic

#3 - Set the state of the control with GUICtrlSetState to $GUI_DISABLE. If you have any of the other controls accessed, the enable the control with GUICtrlSetState to $GUI_ENABLE

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...