logo
down
shadow

How to Keep a Beep sound Playing till Msgbox is closed


How to Keep a Beep sound Playing till Msgbox is closed

By : mj1913
Date : November 22 2020, 02:59 PM
This might help you How to make the Beep Sound start, and Continue repeating till the MsgBox is Closed in VBA Excel? Assume that We have This Code for Example , Try
code :
Do While Msgbox "Invalid text found  . . . . . "

Loop
 Do While SomeUserForm.show 

 `Cant think of the correct time script now and Im not at my pc`

 TIME NOW = time + 1

 Beep

 Loop
Private Sub ErrorBeep()

    'For ensuring the Toggle Button value is False
    UserForm1.ToggleButton1.Value = False

    'Showing UserForm1
    UserForm1.Show
    'Creating the Beep Loop
             'By a ToggleButton you can check the status from your Main Sub or Code
    Do Until UserForm1.ToggleButton1.Value = True

        'Current Time plus 1 second
        Wait1Second = Time + #12:00:01 AM#
        'Do Until current time is greater than the delayed time
        Do Until Wait1Second < Time
            'DoEvents helps the operating system catchup in loops
            DoEvents
            'Checking if the Button has been pressed to avoid a delay between the loops to remove the message
            If UserForm1.ToggleButton1.Value = True Then Exit Do

        Loop
        'Having your beeps
        Beep
    Loop
    'Hiding the UserForm when the Toggle Button have been pressed
    UserForm1.Hide

    'I assume you will want to repeat this Form
    'For next use reset the ToggleButton Value
    UserForm1.ToggleButton1.Value = False
End Sub


Share : facebook icon twitter icon
how to replace Windows.Beep with modern beep sound

how to replace Windows.Beep with modern beep sound


By : graham
Date : March 29 2020, 07:55 AM
help you fix your problem how to replace Windows.Beep with modern beep sound that comes from speakers with adjustable volume? , Try this one
code :
uses MMSystem;

procedure TForm1.Button1Click(Sender: TObject);
begin
  sndPlaySound('C:\Windows\Media\sound.wav',
    SND_NODEFAULT Or SND_ASYNC Or SND_LOOP);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  sndPlaySound(nil, 0); // Stops the sound
end;
beep sound till any input

beep sound till any input


By : Pixy
Date : March 29 2020, 07:55 AM
To fix the issue you can do Disclaimer: I'm not a Windows programmer, I don't know if this is good style or even if it will compile or work. I can't test it here. However, as no one else has given a solution, it's a starting point. I'll edit this answer as I learn more, and hopefully someone who knows more about this will turn up.
Edit: I faked out _kbhit() to a trivial function returning false, and it at least compiles and looks like it runs ok
code :
#include <windows.h>
#include <conio.h>
#include <ctime>
#include <iostream>
#include <string>

int main()
{
    time_t startTime, lastBeep, curTime;
    time(&startTime);
    lastBeep = curTime = startTime;
    char input = '\0';

    while ( difftime(curTime,startTime) < 30.0 )
    {
        if ( _kbhit() ) // If there is input, get it and stop.
        {
            input = _getch();
            break;
        }
        time(&curTime);
        if ( difftime(curTime,lastBeep) > 1.0 ) // More than a second since last beep?
        {
            std::cout << "\a" << "second\n" << std::flush;
            lastBeep = curTime; // Set last beep to now.
        }
    }
    if ( input )
    {
        std::cout << "You hit: \"" << input << "\"\n" << std::flush;
    }

    return 0;
}
JS for playing beep sound for notification not working as expected

JS for playing beep sound for notification not working as expected


By : allen7826
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I think the problem on your code is this if statement if (existingCount == "") . if your exisitingCount should be an integer you don't have to test this, otherwise whenever your exisitingCount equals to 0 your sound will be played.
But if sometimes you can get an empty string then you can optimise your code and removing the first condition, and parse all the data before you start testing :
code :
        function myFunction() {
            $.get("AjaxServicesNoty.aspx", function (data) {
                var recievedCount = parseInt(data);
                var existingCount = parseInt($("lblEventCount").text());

                if ( recievedCount > existingCount ) {
                    $(".lblEventCount").html(recievedCount);
                    $(".lblAcceptedCount").html(recievedCount);
                    var sound = new Audio("Sound/notificatonSound.wav"); 
                    sound.play();
                } else {
                    $(".lblEventCount").html(existingCount);
                    $(".lblAcceptedCount").html(existingCount);
                }
            });
        }
        setInterval(myFunction, 3000);
Playing Beep sound in background

Playing Beep sound in background


By : David Benz
Date : March 29 2020, 07:55 AM
will help you You should start the beep sound right before the messagebox appears. In order not to have too many unused threads you have to abort them in both cases.
Finally I would suggest using a while(true) loop in order to get an endless beep sound.
code :
    public void retry()
    {
        Thread beepThread = new Thread(new ThreadStart(PlayBeep));
        beepThread.IsBackground = true;
        beepThread.Start();

        if (MessageBox.Show("Item not found", "Alert", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
        {
            beepThread.Abort();
            retry();
        }
        else
        {
            beepThread.Abort();
            Console.Beep(500, 1);
            return;
        }
    }

    private void PlayBeep()
    {
        while(true)
           { Console.Beep(500, int.MaxValue); }
    }
Playing the default Beep sound

Playing the default Beep sound


By : Breezy
Date : March 29 2020, 07:55 AM
will help you Twilio developer evangelist here.
You can play anything you want by using the verb. So in the example above, you could do the following:
code :
<Say>Enter your answer after the beep.</Say>
<Play>https://www.soundjay.com/button/sounds/beep-01a.mp3</Play>
<Gather action="/blah"></Gather>
Related Posts Related Posts :
  • Invalid SQL statement expected; ‘DELETE’,’INSERT’,
  • Error 438 when copying data from closed workbook
  • How to return a string with line break from Excel VBA user defined function
  • Problems getting excel to run vba code when a cell is selected
  • Copy and Paste Macro to specific Column Ranges
  • Excel vba add named range
  • Limit Excel Formula Result Containting Numbers and Text to 2 Decimal Places
  • Time format error when seconds value is a multiple of 10
  • Adjust window size to set range without zoom
  • Auto-incrementing INDIRECT function
  • Error using Vlookup function in Excel
  • IF ELSE using MID in excel
  • Excel VBA multiple error handling in the same procedure
  • Userform combobox take first value only - Excel VBA
  • Enhanced VLOOKUP formula
  • Copied charts not visible in Excel Online
  • Flagging '0.0' value
  • Summing up horizontally with condition
  • Using 'RefEdit' control to check specific range
  • Produce a matrix using INDEX and MATCH functions
  • SUMIF formula for months
  • Import text files with commas into Excel
  • User Defined Function calculation mess up
  • Shell.namespace not accepting string variable, but accepting string itself
  • Find particular data and copy the contents till the row ends
  • Change language for ADODB.Recordset or ADODB.Connection
  • Save .csv comma overload
  • Adjust window size
  • Vba to Compare two columns in excel and fetch the corresponding values
  • How can I pass the string value inside the Range as a reference?
  • Combine rows with identical fields of information
  • How to extract piece of string within string
  • Code for matching multiple criteria cannot handle mismatch/interruption
  • SUMIFS: How to write column names as formula while specifying a range?
  • How to select a cell in excel VBA?
  • How to use an IF statement to calculate commissions or flat fee
  • Need help getting child element using Excel XMLHTTP
  • Passing a value from UserForm to sheet
  • Formatting text to bold and inserting formula to get sum
  • How to find a cretin point in a excel file
  • How to allow only one ToggleButton to be ON at a time in Excel
  • Average in 'For' loop
  • Tell loop to only paste in one cell and not all the way down
  • Format Excel file to Export data to Excel in ashx in vb.net
  • Object required error '424'
  • Select a CheckBox from another worksheet
  • Range.Find() fails
  • How can I make userform to work like inputbox?
  • Get visible row and column number
  • Grouping data tables
  • 'DoCmd.TransferSpreadsheet' to export to Excel
  • How dynamically to change the formula of a cell
  • How to skip cells with text?
  • Splitting string of email addresses into different columns using the next available row
  • Remove duplicated values in column, leaving only those which are higher in terms of rows
  • How to create interdependent columns in Excel?
  • How can I get a cell in a fixed column, but dynamic row, to change when another cell in the corresponding row is updated
  • Error Handler not working on "438 run time error"
  • CopyPaste data range values to next empty rows
  • Hide rows where cells in Column C are '0'
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co