Jump to content

Alarm


Faustvii
 Share

Recommended Posts

AlarmDialog

#NoTrayIcon
FileInstall("Alarm.exe", "")
GUICreate("Alarm", 500, 200)
GUICtrlCreateLabel("Set Alarm Time:", 30, 50)
GUICtrlCreateLabel("Set Alarm Sound:", 30, 85)
GUICtrlCreateLabel("Press Here when your Awake -------->", 30, 135)
GUICtrlCreateLabel("If you click exit or close this program then the alarm wont work keep this open.", 30, 175)
$Time = GUICtrlCreateInput("00:00:00", 30, 65, 210, 20)
$alarmsound = GUICtrlCreateInput("wakeup.mp3", 30, 105, 210, 20)
$alerboxtime = GUICtrlCreateButton("Set Time", 242, 62, 95)
$alerboxsound = GUICtrlCreateButton("Set Sound", 242, 102, 95)
$imup = GUICtrlCreateButton("Im Awake", 242, 130, 95)


GUICtrlCreateLabel("Options:", 400, 10)
$Exit = GUICtrlCreateButton("Exit", 400, 25, 95)
$startalarm = GUICtrlCreateButton("Start", 400, 50, 95)
$start = IniWrite( "alarmsetup.ini", "Settings", "Alarmtime", "00:00:00")
$start1 = IniWrite( "alarmsetup.ini", "Settings", "AlarmSound", "wakeup.mp3")
$Alarmfile = IniRead("alarmsetup.ini", "Settings", "Alarmsound", "wakeup.mp3")
$Alarmtime = IniRead("alarmsetup.ini", "Settings", "Alarmtime", "")
GUISetState(@SW_SHOW)

Func Alerttime()
    $whattime1 = GUICtrlRead($Time)
    $whattime = IniWrite( "alarmsetup.ini", "Settings", "Alarmtime", "" & $whattime1)
    MsgBox(1, "Alarm", "Alarm Time Is: " & $whattime1)
EndFunc;==>Alerttime

Func alarmstart()
    Run( "Alarm.exe")
EndFunc;==>alarmstart

Func Alarmsound()
    $whatsound1 = GUICtrlRead($alarmsound)
    $whatsound = IniWrite( "alarmsetup.ini", "Settings", "AlarmSound", "" & $whatsound1)
    MsgBox(1, "Alarm", "Alarm Sound Is: " & $whatsound1)
EndFunc;==>Alarmsound
Func close()
    ProcessClose("Alarm.exe")
    ProcessClose("AlarmDialog.exe")
EndFunc;==>close

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $startalarm
            alarmstart()
        Case $msg = $imup
            ProcessClose("Alarm.exe")
        Case $msg = $alerboxtime
            Alerttime()
        Case $msg = $alerboxsound
            Alarmsound()
        Case $msg = $Exit
            close()
    EndSelect
WEnd

Alarm

#include <Date.au3>
#NoTrayIcon
$Alarmfile = IniRead("alarmsetup.ini", "Settings", "Alarmsound", "")
$Alarmtime = IniRead("alarmsetup.ini", "Settings", "Alarmtime", "")

Func Wakeup()
    $alarm = $alarm + 1
    Do
        SoundPlay($Alarmfile, 1)
            Sleep(2500*87)
    Until $alarm = 350
EndFunc ;==>Wakeup

While 1
    $time1 = _NowTime(5)
    Sleep(250); sleep
    Sleep(250); sleep
    Sleep(250); sleep
    Sleep(250); sleep
    If $time1 = $Alarmtime Then Wakeup()
    
WEnd

First run alarmdialog and then run alarm

Tell me what you think.. Ty updated alarm whit help from SmOke_N

Edited by Liope
Link to comment
Share on other sites

  • Moderators

28 views and no replys :lmao:

$alarm = 1 + 1
    Do
        SoundPlay($Alarmfile, 1)
        $x = 1 + 1
        Do
            Sleep("2500")
        Until $x = 87
    Until $alarm = 350

Wouldn't you just be stuck in the 2nd Do loop forever? You never let it out of the loop because $x will never = 87 if it can't continue. I don't know what your trying to accomplish there or I would try to write a For loop for you on it.

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.

Link to comment
Share on other sites

  • Moderators

Would this work?

For $i = 1 To 350
        SoundPlay($Alarmfile, 1)
        Sleep(2500*87)
    Next

or this?

Local $alarm = 0
    Do
        $alarm = $alarm + 1
        SoundPlay($Alarmfile, 1)
        Sleep(2500*87)
    Until $alarm = 350

Edit: Typo

Edited by SmOke_N

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.

Link to comment
Share on other sites

  • Moderators

For future reference also, $x = 1 + 1 will always = 2, you'll delclare $x then use $x = $x + 1 for released version or $x += 1 for beta version.

Local $x = ''
Do
    $x = $x + 1
Until $x = 100
MsgBox(0, 'Test', $x)

Or for beta

Local $x = ''
Do
    $x += 1
Until $x = 100
MsgBox(0, 'Test', $x)

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.

Link to comment
Share on other sites

  • Moderators

i made this a loooooooooooooooooooooooooooooong time ago

and it was more easy to use -.-

and that all, because it was only 1 data!

Any point here other than your perfection in helping Liope with his/her project?

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.

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