SOliver Posted September 30, 2011 Posted September 30, 2011 Hi folks, Yesterday evening I found myself with no internet and no means of setting an alarm (I use an online alarm clock since the computer is never off). Not one to be discouraged to go out without a fight I wrote the following, in no way practical, alarm function that I thought would be fun to share with the community. NOTE: This function is nothing more than the product of a lot of guess work (vl-load-com) ;param d: time offset from the time the function is called. (defun alarm (d / cdate getUpAt cdate track wmplayer loop) (setq track "c:\\alarm.mp3") (setq cdate (getvar 'date)) (setq getUpAt (+ cdate d)) (setq loop t) (while (= loop t) (setq cdate (getvar 'date)) (if(<= getUpAt cdate) (progn (setq wmplayer (vlax-create-object "WMPlayer.OCX.7")) (vlax-put wmplayer 'url track) (setq loop nil) ) ) ) ) Quote
pBe Posted September 30, 2011 Posted September 30, 2011 Where's the function to trigger this alarm? I assume you use a reactor otherwise you will need to call this routine from time to time. You can also incorporate a "local" callback function within a lisp program to check 'CDATE before runing the main routine. if conditon is True then pass the argument to your routine. any method you choose, It is vital to use a "trigger" for this to be an effective alarm clock. or maybe i'm just missing something Quote
SOliver Posted September 30, 2011 Author Posted September 30, 2011 Where's the function to trigger this alarm? I assume you use a reactor otherwise you will need to call this routine from time to time. You can also incorporate a "local" callback function within a lisp program to check 'CDATE before runing the main routine. if conditon is True then pass the argument to your routine. any method you choose, It is vital to use a "trigger" for this to be an effective alarm clock. or maybe i'm just missing something Nope you're one hundred percent correct; the function itself isn't practical for recurring use, it was created solely as an end to a means. I've only posted it for its humourous nature, possibly to show that if a computer can carry out a task it can be written in lisp lol. I had thought about using a reactor to trigger it but it was past my bed time so I just let it loop over night Quote
pBe Posted September 30, 2011 Posted September 30, 2011 I had thought about using a reactor to trigger it but it was past my bed time so I just let it loop over night Thats what i thought Anyhoo. Good stuff SOliver Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.