Computer Hope
Microsoft => Microsoft DOS => Topic started by: Boozu on September 18, 2009, 03:01:29 AM
-
I want to make simple beeps and boops in a batch program withought having to call a audio file. Is there any way to do that? I want it so I can output Morse code. Why? Just because it would be cool.
-
You can write ECHO followed by ALT+7. (on the number pad). On my system I can write ^G (control+G), and it does the same thing.
ECHO ^G
Two-Eyes %
EDIT: but that is only one sound...
-
That did absolutely nothing. Anything else?
-
what did you do exactly?
-
For morse, you would be restricted to dahs only !
At least in the UK you could spell MOT (and TOM)
-
Two-eyes: I did echo "^G" "alt+7" and "•" <The symbol derived from pressing alt and then 7. I got no change at all.
gpl: If by dahs you mean a short beeps then that is not a big deal. If there is no way to lengthen the duration of the sound then I will do something like this with the beeps. . . . ... ... ... . . . Basically putting a distinguishable pause in bitween a single beep and a line of beeps.
-
I see. When i press alt+7 it shows "^G". In your case, it shows that dot.
Well, i know that 7 is the ascii code for the bell..... I'm sorry, but I don't know why it isn't working for you. Be sure you press the number pad's 7 (although I bet you did, cos the dot was shown).
Try control+G and see what happens.
Two-Eyes %
-
That did not work but on the ascii table (I just learned about this thing this afternoon, haha) under Oct it says 007. I tried that and I immediately heard a ding but it did not put out a symbol in the batch file so I tried alt+007 but nothing happend. So how can I tell the batch file to do the equivalent of alt+007?
-
Ahhh, I see. Were you trying in a batch file? I was trying on the command prompt itself. When I tried to write alt+7 in a batch file, I couldn't. Then I tried this:
c:\>COPY CON bell.bat
@ECHO off
ECHO [and here I pressed alt+7, and the ^G symbol appeared]
[I pressed ctrl+Z and this symbol appeared: ^Z, then I pressed ENTER]
When I ran the batch file the bell was heard:
c:\>bell.bat
[bell was heard]
c:\>
When I open the batch file in notepad, after ECHO, there was a symbol that represents a non-printable character (a box. Can't paste it here >:().
So what you can do is this:
1) use COPY CON to insert one "bell"
2) open the batch file in notepad(or whatever), and whenever you want to output the sound, copy the symbol and paste it
hope this helped
Two-Eyes %
PS. If you didn't understand anything (which i bet you didn't ;D...cos, sry, but... I'm that way), just tell me, but please don't curse me to heck ;)
-
I also, just discovered this:
In the EDIT window, you can press ctrl+p to insert a special character...so you can do this:
ECHO [control+p] [alt+7]. Unfortunately, you can't do that in notepad :(
Two-Eyes %
-
Ok. I am totally lost. What do I have to do? The ctrl+z is paste and ctrl+p is print so what are thous supposed to do? You said something about not being able to do it in notepad and that you did hear something at one point right? So how do I do that? One more question, when you say ^G and ^Z do you literally mean the "^" symbol and the letter "G" and the same for the other or is the combination supposed to mean something?
-
Ok...very sorry...I need to learn how to communicate.
The ctrl+z is paste and ctrl+p is print so what are thous supposed to do?
!!!I was not working in notepad, but in the command prompt!!!
I gave it this command: COPY CON [filename]
and then wrote ECHO [alt+7], ENTER
[ctrl+Z], ENTER
One more question, when you say ^G and ^Z do you literally mean the "^" symbol and the letter "G" and the same for the other or is the combination supposed to mean something?
no, I didn't mean "^" and "G" but [ctrl+G] and those symbols APPEARED. Same for Z.
What do I have to do?
So again:
1) in the command prompt do this:
C:\>COPY CON bell.bat
@ECHO off
ECHO [alt+7]
[ctrl+Z]
C:\>bell.bat
[sound is heard]
C:\>
2) THEN you can open bell.bat in notepad, and copy the (NEW) symbol as many times as you want, adding pauses, etc.
You said something about not being able to do it in notepad
Forget that...it was just an extra note. :)
Hope that's better,
Two-Eyes %
-
That is so weird. Manually doing the exact same thing does not work. So I copied it many times and it only gave me one beep but then I did this:
@echo off
echo
echo
echo
echo
pause
echo
echo
echo
echo
echo
echo
echo
echo
echo
And I got 4 beeps and once a button was pressed I got 1 more beep. Funny. Now I will play with pauses insted of making the person running it press a button. Does that make since? Thanks for the help. Once I get it to a point that I like, I will upload the file for you guys to try.
-
It worked for me.... ???
Thanks, looking forward for the program, i suggest you use sleep.exe for pauses, but i don't know if it can part-seconds :-\
Two-Eyes %
-
i suggest you use sleep.exe for pauses, but i don't know if it can part-seconds
C:\>sleep /?
Usage: sleep time-to-sleep-in-seconds
sleep [-m] time-to-sleep-in-milliseconds
sleep [-c] commited-memory ratio (1%-100%)
There are 1000 milliseconds in 1 second.
-
dangit....didn't come to mind...silly me
Thanks :)
-
Ok well this is how I did a simple s.o.s.
@echo off
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo
So copy that to a batch file and play it. I hope no problems come up because of the copy past over the web.
-
Thanks for the code :). (but i still don't know how to interpret morse...to Google)
At S.T.:
c:\>sleep /?
Arguments are: Sleep <seconds>
www.tricerat.com
Two-Eyes %
-
Well it is supposed to be interpreted as ...---... dot dot dot dash dash dash dot dot dot that is S O S as in I NEAD HELP!!! Even is different countries have a different code I think SOS is the same. I don't think it is any different though. Maby if the language uses non standard English symbols.
-
ahhh got it. I thought that the space between the beeps mattered, but the beeps themselves are the letters. thanks, looking forward for other :)
Two-Eyes %
-
Thanks for the code :). (but i still don't know how to interpret morse...to Google)
At S.T.:
c:\>sleep /?
Arguments are: Sleep <seconds>
www.tricerat.com
Two-Eyes %
There are various programs called "sleep.exe" around on the Web. The one I use is the official Microsoft version in the Windows Server 2003 Resource Kit, available here:
http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en#QuickInfoContainer
Lots of other goodies in the Reskit.
After installation, (as it says in the "Instruction" section on that page, under the list of programs), the programs are located in the %Program Files%\Windows Resource Kits\Tools folder.
-
Salmon Trout (love you name fish fish) that is an add-on more or less and unless all users have it it wont work properly. I like using the dos comands that are built in. The sleep and whatever other comands that are added are nice but then you run into compatibility issues.
-
Hmmm... i got the beeping to work. I simply copied the following from the forum post and pasted it into my bat file and saved.
echo
...never mind ... i didn't notice the second page ... it's been a LOOONNG week. :-[
-
Use Ping as an almost replacement to sleep.
Ping localhost -n (time in seconds) -w 1000 > nul
-
^G as I have found can only be added to a Batch file when copy con is used, notepad and EDIT cannot add ^G to a batch.
As far as sending different beep frequencies to the speakers they're a number of ways to do this:
1.Write a VB console app that can accept a frequency and duration that would output(I have one that might work)
2.Use a third-party utility for the job(Heres a good list: Link (http://garbo.uwasa.fi/pc/batchutil.html))
Hope this helps
,Nick(macdad-)
-
Echo CTRL+G (shows ^G)> "%userprofile%\Desktop\beep.bat"
Then modify beep.bat to your purposes.
-
Echo CTRL+G (shows ^G)> "%userprofile%\Desktop\beep.bat"
Then modify beep.bat to your purposes.
That is pretty good Helpmeh. Who told you about it?
Why do I get this one error?:
'' is not recognized as an internal or external command, operable program or batch file.
C:\>Echo ^G >> beep.bat
C:\>Echo ^G >> beep.bat
C:\>Echo ^G >> beep.bat
C:\>beep
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
-
The internal speaker has not been a standard item of PC hardware for some years; it is considered "legacy", like floppy and serial/parallel ports. My little Shuttle and my two Dell Optiplexes don't have them, so if I want beeps I have to play around with WAVs and use external speakers.
-
That is pretty good Helpmeh. Who told you about it?
Why do I get this one error?:
'' is not recognized as an internal or external command, operable program or batch file.
C:\>Echo ^G >> beep.bat
C:\>Echo ^G >> beep.bat
C:\>Echo ^G >> beep.bat
C:\>beep
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
'' is not recognized as an internal or external command,
operable program or batch file.
C:\>
but of course! Control-G isn't a valid command.
you could- go this though:
echo echo ^G>>test.bat
of course for ^G you press Control-G.
if memory serves it is the ASCII "bell" code, which I was originally intended mostly for printers, which would make the bell to call attention when they needed paper or something of that sort. (although in reality I found DOS had a habit of freezing if the Printer encountered difficulties)
Oops... actually, not printers, but early electric typewriters... well, and printers.
-
billrich: You have to do the ^G through the comand prompt window for it to do anything.
Salmon Trout: the built in one may not be standard but if the pc has any speakers then you will hear something.
-
if memory serves it is the ASCII "bell" code [...] early electric typewriters... well, and printers.
The three letter mnemonic for CTRl-G, ASCII 07, is actually BEL, and it goes right back to teletypewriters (TTY) which predated (any) computers by some decades, although the ASCII code set only superseded Baudot in the 1960s.
-
author=Boozu link=topic=92191.msg623779#msg623779 date=1253384501]
billrich: You have to do the ^G through the comand prompt window for it to do anything.
Billrich wrote:
I was able to hear by running beep.bat on my machine ( see above post )
-
Salmon Trout: the built in one may not be standard but if the pc has any speakers then you will hear something.
Nope. I don't hear CTRl-Gs through my external speakers linked to the sound card, and never have. I think you may be mistaken?
-
Ya I was. I thought you ment something ells.
-
Ya I was. I thought you ment something ells.
I just tried it & got quite excited in case it would work... :'(