K-Meleon
KMeleonWiki > Resources > MacroLibrary > KmmPgLdSound
Submitted by: JamesD
Notes:
The PgLdSound macro and associated files will allow the user to hear a sound played when the OnLoad event happens. The OnLoad event is triggered when a page completes loading.
Steps to set up PgLdSound function
[ Step 1 ] Create a new folder in your user macro folder and name it “PgLdSound”. To find your user macro folder do ( Edit –> Configuration –> Profile Directory ) and open the folder called Macros.
[ Step 2 ] Copy at least one sound file into the PgLdSound folder. Windows sound files can usually be found in C:\WINDOWS\MEDIA. Chimes.wav, Ding.wav, and Chord.wav are just three of the files you should find there. Note that only sounds with duration of less than 2 seconds will work with the Sounder.exe program.
[ Step 3 ] Download Sounder.exe and place it in the PgLdSound folder. Sounder.exe is available from http://www.elifulkerson.com/projects/commandline-wav-player.php . Choose “sounder.exe, win32 console application” to download. Your operating system must have the "winmm.dll" in order for Sounder to work. Sounder.exe is a small file (6,656 bytes).
[ Step 4 ] Open your User Macro Folder (Edit -> Configuration -> User-Defined Macros) and create the following text file: “PgLdSound.kmm” from the code below.
[ Step 5 ] When K-Meleon is restarted you will find the sound controls in the “Tools” menu. You will need to ( Page Load Sound -> Configure) and select a sound file, then ( Page Load Sound -> ON ).
Updates:
Open your User Macro Folder (Edit > Configuration > User-Defined Macros) and create the following text file:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage) # # ---------- PgLdSound.kmm # ---------- K-Meleon Macro Language Play Sound at Page Load --------------- # # Dependencies : main.kmm winmm.dll # Resources : - sound files *.wav and Sounder.exe # Preferences : - # Version : 0.5 2007-10-15 # -------------------------------------------------------------------------------- _PgLdSound_Sound_Play{ $_PgLdSound_Use = getpref( BOOL , "k-meleon_pgldsound_use" ); $_PgLdSound_Choice = getpref( STRING , "k-meleon_pgldsound_choice" ); $_PgLdSound_Use ==true ? exec("\"".getfolder(UserMacroFolder)."\\PgLdSound\\sounder.exe\" ".$_PgLdSound_Choice."") : 0; } _PgLdSound_Sound_On{ # checkmark value for the on menu; menuchecked=getpref( BOOL , "k-meleon_pgldsound_use" )==true; # set the userpref k-meleon_pgldsound_use to true; setpref( BOOL , "k-meleon_pgldsound_use", true ); } _PgLdSound_Sound_Off{ # checkmark value for the off menu; menuchecked=getpref( BOOL , "k-meleon_pgldsound_use" )==false; # set the userpref k-meleon pgldsound_use to false; setpref( BOOL , "k-meleon_pgldsound_use", false ); } _PgLdSound_Configure{ #Prompts the user for a file, displaying only the files matching the pattern. $_PgLdSound_Choice_Path = promptforfile( $_PgLdSound_Path, "Sound Files", "*.wav" ); $_PLS_Length = length($_PgLdSound_Path ); setpref( STRING, "k-meleon_pgldsound_choice", substr($_PgLdSound_Choice_Path, $_PLS_Length + 1 )); &_PgLdSound_ModMenuP ; } _PgLdSound_ModMenu{ $_PgLdSound_Popm = "Page Load Sound"; setmenu("&Tools",popup,$_PgLdSound_Popm,Misc); &_PgLdSound_ModMenuP; } _PgLdSound_ModMenuP{ setmenu($_PgLdSound_Popm,macro,"ON" . " (" .getpref( STRING , "k-meleon_pgldsound_choice" ) ." )",_PgLdSound_Sound_On,0); setmenu($_PgLdSound_Popm,macro,"OFF",_PgLdSound_Sound_Off,1); setmenu($_PgLdSound_Popm,separator,2); setmenu($_PgLdSound_Popm,macro,"Configure ...",_PgLdSound_Configure,3); rebuildmenu($_PgLdSound_Popm); #setclipboard("ON" .getpref( STRING , "k-meleon_pgldsound_choice" )); } _PgLdSound_Get_Path{ ### sounder.exe is supposed to be located in a subfolder, PgLdSound, of the user macro folder. $_PgLdSound_Path=getfolder(UserMacroFolder)."\\PgLdSound"; } $OnStartup=$OnStartup."_PgLdSound_Get_Path;"; $OnInit=$OnInit."_PgLdSound_ModMenu;"; $OnLoad=$OnLoad."_PgLdSound_Sound_Play;"; $macroModules=$macroModules."PgLdSound;";