#1
|
|||
|
|||
LOGON - LOGOFF .WAV Sound
Perhaps this question has been asked before, but can someone give me an example of how to add a logon.wav or logoff.wav sound to the end of a Log ON and Log Off VBS script. Can the Windows imbedded logon and logoff.wav files be used?
Any help would be appreciated. Thanks. ![]() Tom |
#2
|
||||
|
||||
The SecureCRT Scripting Manual has a solution which shows how to play .wav files. See Solution: Receive Notification when “Error-Indicating” Text Appears currently pp: 38-39. Can you adapt the example to your script?
Code:
' Attempt to connect... ' . ' . <Your code here... attempt to connect> ' . ' Check to see if we're connected. If so, play sound If Not crt.Session.Connected Then Set myShell = CreateObject("WScript.Shell") Set myFso = CreateObject("Scripting.FileSystemObject") myShell.Run "RunDll32.exe " & _ myFso.GetSpecialFolder(1) & "\msdxm.ocx,RunDll " & _ "/play /close C:\Windows\Media\Logon.wav" End If ' Now loop forever waiting for disconnect Do If Not crt.Session.Connected Then myShell.Run "RunDll32.exe " & _ myFso.GetSpecialFolder(1) & "\msdxm.ocx,RunDll " & _ "/play /close C:\Windows\Media\Logoff.wav" End If Loop Do either of the ideas above help?
__________________
Mike VanDyke Software Technical Support [http://www.vandyke.com/support] |
#3
|
|||
|
|||
Thanks Michael, That is what I was looking for.
Tom. |
#4
|
||||
|
||||
PlayWavSoundFileOrSpeakTextUsingSAPI.vbs
Glad to hear that helped! In case you're interested in more information about playing WAV files, the SecureCRT Scripting Manual is being updated and will contain updated information about using SAPI (the Speech API) to play a WAV file.
Also, I've attached an example VBScript, PlayWavSoundFileOrSpeakTextUsingSAPI.txt, which not only shows how to play a WAV file, but how to "speak" text either hard-coded, and also read from the crt.Screen.
__________________
Mike VanDyke Software Technical Support [http://www.vandyke.com/support] |
#5
|
|||
|
|||
Thanks again Mike. I had to modify the location of the wave file in the original post to; "C:\WINNT\Media\notify.wav" since I'm using Windows XP. Also, When executing the RUN, Windows Media Player always popped up so I'm having to adjust the WAV to PLAY only and not also OPEN.
Tom |
#6
|
||||
|
||||
Interesting - when I try it on XP I'm able to just run the script exactly as attached without modifying the paths or anything else. This surprising (to me) result helps show why examples can only be examples rather than custom fit for all. Examples may require a little tweak in order to do what's needed. Thanks for posting what you needed to do to get the script to work.
![]()
__________________
Mike VanDyke Software Technical Support [http://www.vandyke.com/support] |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|