Play Random Sounds for E-Mail Notifications? 156
An anonymous reader asks: "I, like many of my fellow Outlook-using geek friends, like to set funny sounds to be played when a new message arrives ('Leeroy Jenkins' is the one I have set now). However, we have always wanted to be able to have random sounds be played when a new message arrives, rather than the same sound over and over. I've searched high and low, and I was hoping Slashdot could suggest/write a program that can randomly play sound files from a specified folder when a new message arrives. Any ideas?"
Random sounds? (Score:5, Insightful)
let's get this out of the way. took me 3 mins. (Score:3, Informative)
# updates the sound list
path=$1
find $path -name "*.[Oo][Oo][Gg]" -print > soundlist.txt
find $path -name "*.[Mm][Pp][3]" -print >> soundlist.txt
find $path -name "*.[Ww][Aa][Vv]" -print >> soundlist.txt
find $path -name "*.[Ff][Ll][Aa][Cc]" -print >> soundlist.txt
find $path -name "*.[Aa][Ii][Ff][Ff]" -print >> soundlist.txt
#!/bin/sh
# play random file from filelist
filelist=$1
len=`wc -l $filelist`
n=`expr $RANDOM % $len`
play `sed -n ${n}p $filelist`
Re:let's get this out of the way. took me 3 mins. (Score:1)
-sh: outlook.exe: not found
me@unixish$
Re:let's get this out of the way. took me 3 mins. (Score:2)
Instead of jumping through hoops with -name "*.[Oo][Oo][Gg]", you can just use -iname "*.ogg". Of course, in this instance, it doesn't matter because Windows matches case-insensitively anyway.
Re:let's get this out of the way. took me 3 mins. (Score:1)
Set this script in your KDE events for KMail (Score:2)
Re:let's get this out of the way. took me 3 mins. (Score:2)
You've got it to work in bash.
No, he's got it to work in any Bourne-compatible shell (hine: /bin/sh not /usr/bin/bash), many of which are available for Windows, including bash [steve.org.uk].
Re:let's get this out of the way. took me 3 mins. (Score:1)
Shitty way of doing it... (Score:3, Informative)
Copy one of them and name it "sound.wav" or somesuch.
Make a Scheduled Task that runs every minute.
When "sound.wav"'s Last Accessed time is within the minute, have it randomly select a new sound and overwrite "sound.wav".
Re:Random sounds? (Score:1)
Re:Random sounds? (Score:2)
It's better than that.
Ask about writing an application that will only run with Windows Outlook for playing sounds when email arrives.
It's a cute idea, until you realize that most people who actually leave their speakers on at work, with all those event noises, are loathed by their coworkers for all that noise pollution. It's as bad as loudly farting every few minutes.
Re:Ask ./: Enterprise HW for I/O bound DB server (Score:1)
OK, so far so good.
Our two largest databases are around 90GB and 120GB
That's a data outhouse, not a data warehouse. Last data warehouse that I saw was 16 Terabytes, and I'm sure that's puny compared to many others' experience.
Anyway, your Ask Slashdot isn't much better than the original, because 1) you've asked a very standard machine sizing question, and there are many hungry and qualified consultants out there in need of a job, so hire one of th
laughin at'cha, ha ha haaa (Score:2, Funny)
I'll piss off to where I want to go, and you guys can stay right here in the best goddamn country in the whole wide world, mmkay?
btw: real appropriate username you two have got...do your SUVs with the "USA ribbons" on it have tinted glass too? We know you're on your cell phones anyway, by the way you ride the center line....
You're prolly the ones trying to change your outlook sounds lol
Mail.app rule... (Score:2)
Re:Mail.app rule... (Score:2)
Re:Mail.app rule... (Score:2)
OK, instructions for Outlook (Score:3, Interesting)
1. install Mandrake Linux or similar over the top of Outlook and MS-Windows
2. restore user data
3. configure KMail or Evolution to play random sounds
4. problem solved. forever.
Re:Mail.app rule... (Score:2)
Well, as helpful as that is for Mail.app, but since he specifically asked for Outlook you're just taunting the poor man.
He expects to have to edit the registry or something.
Re:Mail.app rule... (Score:2)
...just before... (Score:2)
My goodness, some people have selective memories!
Re:...just before... (Score:2)
I'm not a programmer but.. (Score:3, Insightful)
Re:I'm not a programmer but.. (Score:2)
Yeesh, thank god I don't have to use that crap at work.
hmm... (Score:4, Interesting)
pretty clunky but relatively simple for the average bear
Re:hmm... (Score:2)
If Windows supports named pipes... (Score:2)
Re:If Windows supports named pipes... (Score:2)
Re:If Windows supports named pipes... (Score:1)
Re:hmm... (Score:2)
Ideas if there isn't software to do this (Score:5, Informative)
Or write a script that occasionally copies a random WAV to notify.wav (which is what outlook plays).
BTW, the place to start looking for outlook info is the excellent slipstick.com
Just write an AppleScript... (Score:1)
(Make help to actually give us some useful information in your post. What OS? That would be a good start.)
Re:Just write an AppleScript... (Score:2)
Re:Just write an AppleScript... (Score:2)
Re:Just write an AppleScript... (Score:2)
Thanks for the tip, but I knew already... I used Outlook (for Mac) for several years before switching to Gmail.
Re:Just write an AppleScript... (Score:2, Interesting)
Re:Just write an AppleScript... (Score:1)
Check this post: http://ask.slashdot.org/comments.pl?sid=156342&ci
Offtopic: Entourage vs. Outlook for IMAP (Score:2)
I confess to being a bit of an IMAP snob: I used PINE and Mulberry until Thunderbird became "good enough" and I switched because of the preferable license. But I am not usually one to bash MS products, even if I choose not to use them.
But REALLY! How screwed up is dev
Re:Offtopic: Entourage vs. Outlook for IMAP (Score:2)
How screwed up is development over in Redmond that they got it right on the Mac & got it wrong on their own OS?
Dunno, but they did the same thing with Internet Explorer - Internet Explorer for the Mac was the first web browser with reasonably complete support for CSS 1, and it also handles the PNG alpha channel just fine. Meanwhile, five years later, the latest version of Internet Explorer for Windows still can't handle the PNG alpha channel, despite the specification being nine years old.
It mus
Re:Offtopic: Entourage vs. Outlook for IMAP (Score:2)
They may start with a similar code base, but they tend to diverge as each department tweaks the software to fit the guidlines of the target OS, and consumer demands for the apps.
This also explains why the Mac Apps are about a quarter of a cycle
Re:Offtopic: Entourage vs. Outlook for IMAP (Score:2)
It is fine if codebases diverge, but it would be nice if the positive improvements on one platform would eventually be back-ported to the other. I don't see that happening. Seems like such a waste.
If Entourage+IE on Mac are better for the reasons cited in this thread, I guess you believe that Mac consumers have stronger demands for apps that comply to standards?
Re:Just write an AppleScript... (Score:1)
Quick, go tell Microsoft, they don't know yet!
http://www.microsoft.com/mac/otherproducts/outloo
Re:Just write an AppleScript... (Score:2)
Re:Just write an AppleScript... (Score:2)
Eww (Score:2)
I feel so sorry for this guy's coworkers.
Re:Eww (Score:2)
why the FUCK (Score:2, Funny)
go use thunderbird.
Re:why the FUCK (Score:4, Funny)
Ooh! What a great idea! (Score:5, Funny)
[click][click][clickity][click]
Done!
SPROING!!!
Oh! I've got an email! Um...no, wait - what was that? Maybe an instant message...nope. Oh no! It's an illegal oper@*^!>$?%_)#&=
Re:Ooh! What a great idea! (Score:1)
Re:Ooh! What a great idea! (Score:1)
Score; -5 Banal (Score:2, Funny)
How to rotate notification sounds? In Microsoft Outlook?? On Slashdot????
Dear Slashdot, how can I cause this person to receive a severe electric shock everytime a new message arrives in his Outlook inbox?
Re:Score; -5 Banal (Score:2)
Perl... (Score:4, Informative)
$SOUNDDIR="/usr/share/sounds";
opendir(DIR,$SOUNDDIR
$count=0;
while(defined($file = readdir(DIR))) {
if($file =~
$files[$count]=$file;
$count++;
}
}
$arraysize=@files;
while(1) {
$rnd=int(rand($arraysize));
$filename=$files[$rnd];
`cp $SOUNDDIR/$filename $DESTFILE`;
sleep 10;
}
Mangle appropriately (source dir, sleep time, dest file, file-type).
Have fun.
Red.
Re:Perl... (Score:2)
* Install activestate perl
* Use appropriate MS compatible directories (c:\path\to\somewhere rather than
* swap out the `cp
Bah, ahh well - can't expect much for 20 seconds of coding and no debugging I guess.
Red.
Re:Perl... (Score:1)
Re:Perl... (Score:2)
How about this, tho? Make a piped file on a samba share, and when something tries to read the file, it executes:
#!/usr/bin/perl
$SOUNDDIR="/usr/share/sounds";
opendir(DIR,$SOUNDDIR) || die "Can't open $SOUNDDIR: $!\n";
$count=0;
while(defined($file = readdir(DIR))) {
if($file =~
$files[$count]=$file;
$count++;
}
}
$arraysize=@files;
$rnd=int(rand($arraysize));
$filename=$files[$r nd];
system("cat $filename");
# --LWM
Re:Perl... (Score:2)
Re:Perl... (Score:2)
> Surely you could get it down to one line
True. I'm too lazy to obfuscate my perl this early in the morning.
> Besides, you're opening yourself up to a followup
> question along the lines of; Outlook won't run
> your program, what should I do?
Ick.. very true. Of course, my geek rating is now rock bottom because people will assume that I actually USE a program like that (or outlook, for that matter).. so with all the stigma & the fact that geek frien
Re:Bash is better (Score:1)
Outlook-using geek (Score:1, Troll)
That's it. Turn in your fucking geek card. Now. There's the door. Get going and don't ever come back here.
Are you ready? (Score:2)
You can do this with VBScript (Score:2)
Bonus points for having it read the config information out of the registry and/or an ini file.
Wow (Score:3, Insightful)
No Problem (Score:4, Funny)
Try a free program (Score:5, Funny)
... Use the Macros (Score:4, Interesting)
Write your macro that plays your sound file.
Go to your Rules & Alerts
Create a rule for receiving emails - to play your Macro.
Bonus point.
Make your macro play a random sound.
I think the whole effort should take about 5 minutes.
Re:... Use the Macros (Score:2, Funny)
MOD PARENT UP!!! (Score:2)
This is better than the Ask Slashdot I submitted.. (Score:5, Funny)
I settled for comic book guy saying "Worst. Slashdot. Story. EVER."
Surprisingly its true every time!
Random audio files in Outlook 2002 for dummies (Score:5, Informative)
- Read directory and store files in a list/array
- Use a random function to pick a wav file
- Load and play the selected audio file
2. Disable e-mail sound notifications (Tools->Options->Email options->Advanced email options->uncheck 'play a sound'
3. Set up a rule for incoming email: (Tools->Rules wizard->New.
Start from a blank rule. Check messages when they arrive (next).
(Next) and confirm to apply to all rules.
Check 'start application'. Click the underlined 'application'. Choose your custom app (open).
(next)(next).
Name the rule 'sound script'
(finish)(ok).
To prevent your script from playing sounds for every email received, put a delay counter on it to prevent multiple instances of the same application, or some form of lock preventing concurrent running.
Re:Random audio files in Outlook 2002 for dummies (Score:2)
I mean, can't you leave me with some shreds of dignity?
Alright, heres my last suggestion, get your colleagues and friends to record a mail notification for you, and attach it to Outlook (via the rules wizard) to play that notification when that person sends you a greeting.
VBA for Outlook (Score:2)
Why just random? (Score:1)
Since my new mail sound is currently a Klingon yellow alert, each email could be a hit on the shields, which slowly regenerate. Too much email in a short period would start a warp-core breach warning followed a huge explosion. Real fans could in
Poly MacBeep (Score:1)
You always were so much fun
Windows needs you now
duh (Score:2)
Skip the boing old alert sound - go festival (Score:3, Interesting)
So anyway I had a bit of a brainwave one day - I hooked up festival (the voice synthesis software) to Evolution (my preferred mail client) and now instead of non-informational alert sounds I have festival read out-loud the sender and subject.
It's probably the best thing since sliced bread as far as I'm concerned (I've had it like this for, umm, about a year I guess, and it's still very cool). Now when an email comes in I don't have to stop what I'm doing, I know if it's important enough to go look at because my PC tells me
Even better..like all good geeks I have my PC running 24/7 a couple of meters from my bed (and like all good geeks I'm the only one in my bed), so no more do I have to get up and go see what the email was if I'm in bed
Most useful thing... ever. Perhaps I should patent it
Here is the code (Score:3, Informative)
Step 2 - Close Outlook and restart Outlook.
Step 3 - Open up the Visual Basic editor.
Step 4 - Add this in the code session of "ThisOutLookSession".
Step 5 - Reformat the thing. I spent more time trying get it through the Slashdot filters than writing it.
Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Function GetAllFilesInDir(ByVal strDirPath As String) As Variant ' Loop through the directory specified in strDirPath and save each ' file name in an array, then return that array to the calling ' procedure. ' Return False if strDirPath is not a valid directory. Dim strTempName As String Dim varFiles() As Variant Dim lngFileCount As Long On Error GoTo GetAllFiles_Err ' Make sure that strDirPath ends with a "\" character. If Right$(strDirPath, 1) "\" Then strDirPath = strDirPath & "\" End If ' Make sure strDirPath is a directory. If GetAttr(strDirPath) = vbDirectory Then strTempName = Dir(strDirPath, vbDirectory) Do Until Len(strTempName) = 0 ' Exclude ".", "..". If (strTempName ".") And (strTempName "..") Then ' Make sure we do not have a sub-directory name. If (GetAttr(strDirPath & strTempName) _ And vbDirectory) vbDirectory Then ' Increase the size of the array ' to accommodate the found filename ' and add the filename to the array. ReDim Preserve varFiles(lngFileCount) varFiles(lngFileCount) = strTempName lngFileCount = lngFileCount + 1 End If End If ' Use the Dir function to find the next filename. strTempName = Dir() Loop ' Return the array of found files. GetAllFilesInDir = varFiles End If GetAllFiles_End: Exit Function GetAllFiles_Err: GetAllFilesInDir = False Resume GetAllFiles_End End Function Private Sub Application_NewMail() Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Dim varFileArray As Variant Dim lngI As Long Dim strDirName As String Const NO_FILES_IN_DIR As Long = 9 Const INVALID_DIR As Long = 13 On Error GoTo Test_Err strDirName = "C:\windows\media" varFileArray = GetAllFilesInDir(strDirName) For lngI = 0 To UBound(varFileArray) Debug.Print varFileArray(lngI) Next lngI lngI = Math.Round(Math.Rnd() * UBound(varFileArray)) WAVFile = "C:\windows\media\" & varFileArray(lngI) Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) Test_Err: Select Case Err.Number Case NO_FILES_IN_DIR MsgBox "The directory named '" & strDirName _ & "' contains no files." Case INVALID_DIR MsgBox "'" & strDirName & "' is not a valid directory." Case 0 Case Else MsgBox "Error #" & Err.Number & " - " & Err.Description End Select End Sub
Step 6 - Ignore all replies to this post. They are all the same Microsoft bashing crap you've already read 1000 times on
Step 7 - If you think this is some kind of virus learn to code and then you can check it yourself.
Step 8 - Fix the API call. It is too slow.
Named pipe. (Score:1)
Oh, right, you can't do that and use Outlook at the same time.
The standard solution (Score:1)
Re:slashdot is soooo dead (Score:1, Offtopic)
This is what passes for "News for Nerds"???
This, and 6 month old dupes of 25-yr old "How computers work" books???
Really, it pisses me off to think that probably a few dozen members got their (far more interesting) stories rejected to make room for this sh*t.
Re:slashdot is soooo dead (Score:2)
Hope you're listening Taco, time for some fresh blood, editorial-wise.
Re:slashdot is soooo dead (Score:2)
http://boingboing.net/ [boingboing.net]
[OT] Critics lunching on dead website carrion (Score:2)
Low quality of stories is your fault as much as mine.
Re:slashdot is soooo dead (Score:4, Insightful)
probably why no mail app has such a feature.
oh sorry, it would be "entertaining"
Re:slashdot is soooo dead (Score:3, Informative)
Not necessarily so.
Imagine different pools of sound files. For example, one pool could be Futurama quotes. The other could be excerpts from Monty Python.
Why you get new mail, it grabs a 'random' Futurama wav. When you have a new IM message, it grabs a 'random' Monty Python wav.
As long as you have two brain cells to rub together, you can figure out that 'Bite my shiny metal ass' is new mail, while 'Ni!' is a new IM message.
Re:slashdot is soooo dead (Score:1)
I see some practical difficulties with this proposition.
Re:slashdot is soooo dead (Score:2)
Re:slashdot is soooo dead (Score:2)
Re:Come on.. (Score:2)
This section is called "Ask Slashdot", not "Make a Wild-Ass Guess to Confuse the Poor Guy E
Re:Come on.. (Score:2)
Re:Come on.. (Score:3, Funny)
Slashdot (makes poor attempt to answer question but just ends up rambling): First it really depends on whether we are talking about frosted, non-frosted pop-tarts and of course we have to account for flavor variety. Second what distribution of cereal are you using since some varieties have more technical merit than others. In my not so humble opinion Cereal in general is the better technical choice since it provides 19 essential vitamins
Re:Come on.. (Score:2)
This has got to be a 5 line script in any language of choice.
I did it all on one line in C, but now I'm not sure what it was I originally intended to do
Re:Come on.. (Score:1)
Depending on how you have outlook configured it may or may not use a PST file (if you're keeping your mail ON A SERVER and accessing it via IMAP or Exchange, how it caches that locally will not be very meaningful to you), but even if it does, you will generate a notification every time you mark a message as read, delete a message, or do anything!
Re:Joke (Score:1)
Re:Joke (Score:2)
I admit it, it was me.
Re:Named pipe (Score:2)
Why troll?
Re:Named pipe (Score:2)
I could use hpux aix solaris etc do the same thing.
This is a windows/unix debate you act like windows can't do this because it is closed.
Re:Named pipe (Score:2)
Haha, classic. "I don't know how, therefore it cannot be done. My ignorance is generalizable as fact." That, sir, is a troll.
Re:Named pipe (Score:2)
Name them 1.wav - n.wav
Point Outlook at 1.WAV for the email notification
Every x minutes, run a script to randomly shuffle the filenames . Said script could exist anywhere, even within Outlook.
Whatever happens to be 1.wav at the time email comes in gets played.
Re:Waste of time... (Score:2)