This is what I am using currently, which works here and hopefully also there without any problems. Some sound junkies might find this also useful...
AnywhereSoundPlayer.ahk
Code:
; plays anywhere a sound file, works in WinDirStat
; dependencies:
; 0. AutoHotkey, http://www.autohotkey.com
; 1. WinDirStat, http://windirstat.info
; how to use:
; - just open WinDirStat in a directory with lots of shorter .wav or .mp3 files and move your mouse
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance Ignore
SetTitleMatchMode, 2
GroupAdd, WinDirStat, WinDirStat
#IfWinActive, ahk_group WinDirStat
{
ReferenceMouseFile := GetStatusBarTextInWindirstat()
Loop
{
Sleep, 400
CurrentMouseFile := GetStatusBarTextInWindirstat()
if (CurrentMouseFile != ReferenceMouseFile)
{
PlaySoundIfOk(CurrentMouseFile)
ReferenceMouseFile := CurrentMouseFile
}
}
return
}
GetSelectedFileName()
{
DateiName =
AlterClipboardInhalt := ClipboardAll ; sichern des Inhaltes von Clipboard
Clipboard =
Send ^c ; Kopiert die Datei
ClipWait, 1 ; Warte auf neuen Inhalt im Clipboard
If (FileExist(ClipBoard)) ; Prüfen, ob es sich um eine existierende
{ ; Datei handelt
DateiName := ClipBoard ; Speichern des Namens zur weiteren Verarbeitung
}
ClipBoard := AlterClipboardInhalt ; Alten Inhalt des Clipboards wiederherstellen
Return DateiName
}
GetStatusBarTextInWindirstat()
{
SetTitleMatchMode, 2
StatusBarGetText, FileUnderMouse, 1, WinDirStat
return FileUnderMouse
}
PlaySound(SoundFile)
{
FileDelete, %A_ScriptDIR%\Sound1.AHK
FileAppend,
(
#NoTrayIcon
SoundPlay, %SoundFile%, Wait
), %A_ScriptDir%\Sound1.AHK
Run, %A_ScriptDIR%\Sound1.AHK
}
PlaySoundIfOk(SoundFile)
{
FileGetSize, SoundFileSize , %SoundFile%, K
SplitPath, SoundFile ,,,SoundFileExtension
if ((SoundFileExtension == "wav" || SoundFileExtension == "WAV") && SoundFileSize < 2000)
{
PlaySound(SoundFile)
}
if ((SoundFileExtension == "mp3" || SoundFileExtension == "MP3") && SoundFileSize < 200)
{
PlaySound(SoundFile)
}
if (SoundFileExtension != "wav" && SoundFileExtension != "mp3")
{
;MsgBox, Sorry, this is not an .mp3 or .wav file. Try another one!
}
}