Pages: 1
RSS
How to setup sound notification for IMAP ?
 
How to setup sound notification for IMAP ?
 
I have the same question for The Bat v5.8.8.  Sound notification works for my POP3 accounts, but I can't even find an option or setting for the IMAP account.
 
Try an incoming filter that plays a sound.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Well, that works, but instead of playing the sound once when I receive a bunch of new emails all at once, it plays the sound once for each new email.  If I get 16 new emails, it sits there and plays the notification sound 16 times, which is kind of ridiculous.
 
I really love The Bat! and this is the only very little nuisance that I always thought could use fixing. Since I was really bored the other day I wrote myself a program that will play a notification sound that can be set up as an incoming filter. It addresses the problem Warner mentioned so it will only play the notification sound once if you get multiple new emails.

To set it up, create a new filter for any message and run it as external action like so
Code
C:\Program Files (x86)\The Bat!\batsound.exe "C:\Windows\Media\notify.wav"
If you drop the path to the wav file, the program will play the default mail beep of the active Windows sound theme.

You can download the program here.

If you prefer to build it yourself, here's the source code:
Code
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif // !_CRT_SECURE_NO_WARNINGS
#include <time.h>
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#pragma comment (lib, "winmm.lib")
#define DEFAULT_TIMEOUT      10
#define PROGRAM_GUID      _T("F343833A-CC2D-4F9B-A619-AEA408E0CC2C")
#define SND_MAILBEEP      _T("MAILBEEP")
int _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR lpCmdLine, int nCmdShow)
{
   HANDLE hMutex = CreateMutex(NULL, TRUE, PROGRAM_GUID);
   if (GetLastError() == ERROR_ALREADY_EXISTS) {
      CloseHandle(hMutex);
      return 1;
   }
   time_t last;
   FILE *fp;
   int timeout = __argc > 2 ?_tstoi(__targv[2]) : DEFAULT_TIMEOUT;
   TCHAR szTmpDir[MAX_PATH], szFile[MAX_PATH + _MAX_FNAME];
   GetTempPath(sizeof(szTmpDir), szTmpDir);
   _stprintf_s(szFile, _T("%s\\%s"), szTmpDir, PROGRAM_GUID);
   if (fp = _tfopen(szFile, _T("r+"))) {
      if(EOF != _ftscanf(fp, _T("%lli"), &last)) {
         time_t diff = time(NULL) - last;
         if (diff < timeout)
            return 1;
      }
   }
   else {
      if(!(fp = _tfopen(szFile, _T("w"))))
         return 1;
   }
   if (__argc > 1)
      PlaySound(__targv[1], NULL, SND_FILENAME);
   else
      PlaySound(SND_MAILBEEP, NULL, SND_ALIAS);
   fseek(fp, 0, SEEK_SET);
   _ftprintf(fp, _T("%lli"), time(NULL));
   fclose(fp);
   CloseHandle(hMutex);
   return 0;
}
Pages: 1