I'm doing a Mathematica Notebook and I want to make an alarm clock. Something like this:
SetAttributes[Horas, HoldRest]
(* Get System Hour *)
Hours = Dynamic[Refresh[DateList[][[4]], UpdateInterval -> 1]];
SetAttributes[Mins, HoldRest]
(* Get System Mins *)
Mins = Dynamic[Refresh[DateList[][[5]], UpdateInterval -> 1]];
If[
SameQ[ToString[Hours], ToString[alarmh]]
&& SameQ[ToString[Mins],ToString[alarmm]],
Quiet@EmitSound[Sound[SoundNote["D", 1,"Tinklebell"]]]
];
alarmm
and alarmh
are variables that the user select from a listbox When the variables from the listbox are the same with the system hour I want to sound a bell.
The problem is that if I make Dynamic variable I can't compare them, but if I do this:
Refresh[DateList[][[5]], UpdateInterval -> 1];
I can compare between them, but the time doesn't update...
How can I make it update?
Comments
Post a Comment