- Joined
- May 25, 2009
- Messages
- 6,637
- Thread Author
- #1
Sub title "How to spend a lot of time trying to do something that Microsoft doesn't want you to, for some obscure reason".
Hi Guys
I'm trying to write a script to play a sound at Windows 8 startup.
I want to do this by placing the .vbs script file in the Startup Folder.
I read that this can be done, and I've researched it a bit.
I'll link to the research and the end of this post.
Here's my script.
strSoundFile = "C:\My Windows Sounds\Hello Michael Brit.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "C:\Small Player\splayer.exe" /play /close "C:\Windows\My Windows Sounds\Hello Michael Brit.wav"
objShell.Run strCommand, 0, True
Writing scripts is not something I do, I quit after .bat files. LOL
I just can't stand to let Microsoft win!!!
I have the 64 bit version of Small Player installed at the location shown, C:\Small Player\splayer.exe.
My sound is in C:\Window\My Windows Sounds.
The file is named Hello Michael Brit.wav.
I've verified that the sound does play in Small Player, etc.
If anyone who understands this stuff can identify what I'm doing wrong I'd appreciate it.
I'm getting the error message...
Line 3, Char: 57 Error Expected end of statement.
Code 800A0401
I have no idea what that means.
Thanks
Mike
Here's the research.
How Can I Play a Sound From Within a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs
And this post...
As R Sully said, you can make the sounds in question re-appear, but they do not re-sound. For those like me who were stumped by this issue (I'm running Windows 8 Build 9200), I propose a simple solution that works fine for me: Create a script and put it in your (not All users/public) Startup folder.
It's in a hidden folder under your User root called AppData. This script is located at the following website: please paste this link into your address bar-my ability to link is compromised right now.
How Can I Play a Sound From Within a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs
There's something you should know-sndrec32.exe is no longer in windows 8 and the new SoundRecorder.exe, located in the system32 folder, is unable to run from there because it's 64-bit and cannot launch from a 32-bit container.
I suggest smallplayer portable, available from Softpedia via this link: you need to paste it-I cannot link for some reason...
Small Player Free Download - OGG Players
When you compose the script (using notepad), make sure you replace the sndrec32.exe path with the file location of smallpayer0.74.
To copy a path, simply use the command on File explorer when the file is highlighted. Then highlight the path for sndrec32, and paste the link over it.
Delete any quotation marks that are not outside the total path, arguments included (e.g. /play /close) otherwise the script will fail, showing you a dialog that says where the error is in the script, e.g. Line 3, Char 31.
For the sound you want to play, simply highlight the preset path from quote-to-quote, switch windows to look for a file, then when you find it, copy the file path using the same method you used to copy smallplayer0.74's path.
Then switch back to notepad, and use Ctrl+V to paste, and the path that was there previously will be replaced by what you pasted.
If the file looks similar to what The Scripting Guy displays (besides the edits I've mentioned), save as All files, and name the document with a .vbs extension (the name is up to you).
From there, copy and paste the .vbs file into your startup folder, located in %OS%\Users\%YOURUSER%\AppData\Microsoft\Windows\Start Menu\Programs\Startup\. You may need to "show Hidden Files and Folders."
I hope this works for anyone who's suffered the same frustration I had.
Hi Guys
I'm trying to write a script to play a sound at Windows 8 startup.
I want to do this by placing the .vbs script file in the Startup Folder.
I read that this can be done, and I've researched it a bit.
I'll link to the research and the end of this post.
Here's my script.
strSoundFile = "C:\My Windows Sounds\Hello Michael Brit.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "C:\Small Player\splayer.exe" /play /close "C:\Windows\My Windows Sounds\Hello Michael Brit.wav"
objShell.Run strCommand, 0, True
Writing scripts is not something I do, I quit after .bat files. LOL
I just can't stand to let Microsoft win!!!
I have the 64 bit version of Small Player installed at the location shown, C:\Small Player\splayer.exe.
My sound is in C:\Window\My Windows Sounds.
The file is named Hello Michael Brit.wav.
I've verified that the sound does play in Small Player, etc.
If anyone who understands this stuff can identify what I'm doing wrong I'd appreciate it.
I'm getting the error message...
Line 3, Char: 57 Error Expected end of statement.
Code 800A0401
I have no idea what that means.
Thanks
Mike
Here's the research.
How Can I Play a Sound From Within a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs
And this post...
As R Sully said, you can make the sounds in question re-appear, but they do not re-sound. For those like me who were stumped by this issue (I'm running Windows 8 Build 9200), I propose a simple solution that works fine for me: Create a script and put it in your (not All users/public) Startup folder.
It's in a hidden folder under your User root called AppData. This script is located at the following website: please paste this link into your address bar-my ability to link is compromised right now.
How Can I Play a Sound From Within a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs
There's something you should know-sndrec32.exe is no longer in windows 8 and the new SoundRecorder.exe, located in the system32 folder, is unable to run from there because it's 64-bit and cannot launch from a 32-bit container.
I suggest smallplayer portable, available from Softpedia via this link: you need to paste it-I cannot link for some reason...
Small Player Free Download - OGG Players
When you compose the script (using notepad), make sure you replace the sndrec32.exe path with the file location of smallpayer0.74.
To copy a path, simply use the command on File explorer when the file is highlighted. Then highlight the path for sndrec32, and paste the link over it.
Delete any quotation marks that are not outside the total path, arguments included (e.g. /play /close) otherwise the script will fail, showing you a dialog that says where the error is in the script, e.g. Line 3, Char 31.
For the sound you want to play, simply highlight the preset path from quote-to-quote, switch windows to look for a file, then when you find it, copy the file path using the same method you used to copy smallplayer0.74's path.
Then switch back to notepad, and use Ctrl+V to paste, and the path that was there previously will be replaced by what you pasted.
If the file looks similar to what The Scripting Guy displays (besides the edits I've mentioned), save as All files, and name the document with a .vbs extension (the name is up to you).
From there, copy and paste the .vbs file into your startup folder, located in %OS%\Users\%YOURUSER%\AppData\Microsoft\Windows\Start Menu\Programs\Startup\. You may need to "show Hidden Files and Folders."
I hope this works for anyone who's suffered the same frustration I had.