EdFred
knows enough, dangerous
- Local time
- Yesterday, 19:46
- Joined
- Mar 2, 2007
- Messages
- 131
...you do this:
There was question asked on the forum a couple weeks ago about setting an event reminder that always triggered at a certain time period. Then I got to thinking about it, because I never use the timer function in Access. So I started experimenting, at first it started out with just triggering a message box. Of course the code would stop until I clicked ok. Then I set it up to run a Beep instead of the message box function. And from there I started wondering if I could get it to play an MP3.
So I used the shell function to call a specific MP3. But you can't call a non-executable - at least I couldn't at first try. I thought since the file type was associated, it would work, but it didn't. So then I called windows media player, but it doesn't autoplay when opened as a stand alone program. So then I called WinAmp, and found that when you put in a specific filename in the shell call it will automatically play that mp3. Then I thought, why not make this thing a full blown alarm clock? Ooooh, bad idea, it always plays the same song, and I certainly don't want to feel like I am in the movie Groundhog Day. Aha! I can call a playlist in winamp. Excellent, and since I have random play turned on in Winamp it plays a different song off the list when it's opened. The next problem was, what do all alarm clocks have? A snooze button. So I built a snooze button into it, and then ran into my next issue:
Winamp runs independently from Access, so closing it could be a real pain if I was to have a snooze button. Oooh, but I could put it in as an activeX control? Well, I couldn't find an easy way to do that but windows media player is easily put in as an active x control. So I did that, and whenever the form it is in gets opened it automatically plays. Rock on. Oh crap, I'm back to the specific song again in the properties of the wmp control. So then I thought hey, it's got properties, I can change them when I call the second form to be opened. I have to build a list, and select a song from it. No, I don't want to do that, that would be a pain, and be too much busy work of inputting all the songs I want to choose from. Ah, but I can take my playlist, save it as a text file, tweak it, and import the filenames to a table in the database. Give each one a unique ID number, generate a random number, open the recordset (i know, I could have used Dlookup, but I never messed with it before) where the unique ID is equal to the random number generated, write the filename to a string, and when I open up the form with the player I set that attribute in code and voila my musical alarm clock. Oh, and when I hit snooze, it regenerates the random number and plays a different song for the next time it goes off.
Wow, how pathetic. What's worse, I keep using the laptop as an alarm clock.
I hate you all for making me learn something.
There was question asked on the forum a couple weeks ago about setting an event reminder that always triggered at a certain time period. Then I got to thinking about it, because I never use the timer function in Access. So I started experimenting, at first it started out with just triggering a message box. Of course the code would stop until I clicked ok. Then I set it up to run a Beep instead of the message box function. And from there I started wondering if I could get it to play an MP3.
So I used the shell function to call a specific MP3. But you can't call a non-executable - at least I couldn't at first try. I thought since the file type was associated, it would work, but it didn't. So then I called windows media player, but it doesn't autoplay when opened as a stand alone program. So then I called WinAmp, and found that when you put in a specific filename in the shell call it will automatically play that mp3. Then I thought, why not make this thing a full blown alarm clock? Ooooh, bad idea, it always plays the same song, and I certainly don't want to feel like I am in the movie Groundhog Day. Aha! I can call a playlist in winamp. Excellent, and since I have random play turned on in Winamp it plays a different song off the list when it's opened. The next problem was, what do all alarm clocks have? A snooze button. So I built a snooze button into it, and then ran into my next issue:
Winamp runs independently from Access, so closing it could be a real pain if I was to have a snooze button. Oooh, but I could put it in as an activeX control? Well, I couldn't find an easy way to do that but windows media player is easily put in as an active x control. So I did that, and whenever the form it is in gets opened it automatically plays. Rock on. Oh crap, I'm back to the specific song again in the properties of the wmp control. So then I thought hey, it's got properties, I can change them when I call the second form to be opened. I have to build a list, and select a song from it. No, I don't want to do that, that would be a pain, and be too much busy work of inputting all the songs I want to choose from. Ah, but I can take my playlist, save it as a text file, tweak it, and import the filenames to a table in the database. Give each one a unique ID number, generate a random number, open the recordset (i know, I could have used Dlookup, but I never messed with it before) where the unique ID is equal to the random number generated, write the filename to a string, and when I open up the form with the player I set that attribute in code and voila my musical alarm clock. Oh, and when I hit snooze, it regenerates the random number and plays a different song for the next time it goes off.
Wow, how pathetic. What's worse, I keep using the laptop as an alarm clock.
I hate you all for making me learn something.
