# User awake?

**URL:** <https://www.ruby-forum.com/t/user-awake/119995>\
**Category:** Ruby\
**Created:** [November 12, 2007, 7:07pm UTC](https://www.ruby-forum.com/t/user-awake/119995 "2007-11-12T19:07:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ernsttanaka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/46a35a/32.png) [@ernsttanaka](https://www.ruby-forum.com/u/ernsttanaka)\
**Post date:** [November 12, 2007, 7:07pm UTC](https://www.ruby-forum.com/t/user-awake/119995/1 "2007-11-12T19:07:14Z")

</div>

I am a new RUBY programmer. so far I managed to write a ‘listener’ for  
my quote stream, maintain a quote database and fire off email messengers  
as alerts when certain condition occur. This all happened in the last 2  
weeks!

I would like to add a possibility to send these alerts to my cellphone.  
I manage to send them straight forward as an email. Which is good enough  
for me (for now).

But I would like my program select the destination of the email  
automatically based on the fact if I am behind my computer or not.

If behind\_computer  
– send email to desktop  
else  
– send email to cellphone  
end

One of the thoughts I have is to use the mouse movement to determine if  
I am around. Like if the mouse has not been moved for 5 minutes - Then I  
am not around.

q’s  
= Does anyone has a better suggestion  
= Does anyone know how I can figure out if the mouse has been moved  
within the last 5 min

As always thank you!!  
Ernst

---

<div class="post-metadata">

**Author:** ![ernsttanaka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/46a35a/32.png) [@ernsttanaka](https://www.ruby-forum.com/u/ernsttanaka)\
**Post date:** [November 12, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/user-awake/119995/2 "2007-11-12T19:30:20Z")

</div>

On Nov 12, 2007 7:07 PM, Ernst T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> automatically based on the fact if I am behind my computer or not.
> 
> q’s  
> = Does anyone has a better suggestion

depends on the system you are on.  
on linux/unix, you can do `w`.grep(/your\_username/) to see if you’re  
logged in.  
on windows, it would require Win32API or WMI (using COM/Win32OLE)

---

<div class="post-metadata">

**Author:** ![ernsttanaka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/46a35a/32.png) [@ernsttanaka](https://www.ruby-forum.com/u/ernsttanaka)\
**Post date:** [November 12, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/user-awake/119995/3 "2007-11-12T22:20:49Z")

</div>

Jano S. wrote:

> On Nov 12, 2007 7:07 PM, Ernst T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > automatically based on the fact if I am behind my computer or not.
> > 
> > q’s  
> > = Does anyone has a better suggestion
> 
> depends on the system you are on.  
> on linux/unix, you can do `w`.grep(/your\_username/) to see if you’re  
> logged in.  
> on windows, it would require Win32API or WMI (using COM/Win32OLE)

Thanks for you help – I will look into that direction.

By the way I am using Windows XP
