monoceres Posted May 2, 2008 Share Posted May 2, 2008 (edited) Ok this is just for fun, I needed something fun after my last project went down, bad...This will play A-Z and 0-9 as morse.Morse CodeHave fun Edited May 2, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Valuater Posted May 2, 2008 Share Posted May 2, 2008 (edited) Really Cool!!! It seemed to run a bit quickly and hard to tell which letter/number was being heard while the highlighted text was moving. maybe a small sleep in the loop would fix that... Else _SoundPlay($chars[$i] & "_morse_code.wav", 1) _SoundSeek($chars[$i] & "_morse_code.wav", 0, 0, 0) ConsoleWrite($i & @CRLF) Sleep(200) EndIf ... that number might need adjusting Thanks for sharing 8) Edited May 2, 2008 by Valuater Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 (edited) Really Cool!!! It seemed to run a bit quickly and hard to tell which letter/number was being heard while the highlighted text was moving. maybe a small sleep in the loop would fix that... Else _SoundPlay($chars[$i] & "_morse_code.wav", 1) _SoundSeek($chars[$i] & "_morse_code.wav", 0, 0, 0) ConsoleWrite($i & @CRLF) Sleep(200) EndIf ... that number might need adjusting Thanks for sharing 8)Actually there should be a sleep of 270 ms there, (3 small beeps of silence), just forgot to add it Thanks for noticing Edit: Updated first post Edited May 2, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Valuater Posted May 2, 2008 Share Posted May 2, 2008 (edited) This really interested me because I don't know Morse Code. I would really like to know how to "do" SOS. However, in your script it actually plays 4 sounds and that is confusing me a little. I see 0 1 2 3 Is that correct? 8) Edited May 2, 2008 by Valuater Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 This really interested me because I don't know Morse Code. I would really like to know how to "do" SOS. However, in your script it actually plays 4 sounds and that is confusing me a little. I see0103Is that correct?8)I really don't know, I just read the wiki site, and downloaded the sounds there.Here's the link Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 (edited) Now I see the error, I start with element 0 in my array, and since I use StringSplit that is how many number I have. Uploading fixed version Edit: Done, fixed version on top Edited May 2, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Valuater Posted May 2, 2008 Share Posted May 2, 2008 Now I see the error, I start with element 0 in my array, and since I use StringSplit that is how many number I have.Uploading fixed version Great!!Ok, no more complaining from me...lolthx8) Link to comment Share on other sites More sharing options...
Valuater Posted May 2, 2008 Share Posted May 2, 2008 Ok, no more complaining from me...lol 8) How about a positive visual addition heres the code.... expandcollapse popup#region ; Code generated by EzSkin_1-2-3, Created by Valuater ; For personal use only, All Rights Reserved ; Author of this code: Valuater ; Thank you big_daddy and Joscpe #include <EzSkin.au3> ; Author monoceres, source wikipedia #include <Sound.au3> #include <File.au3> #include <GuiEdit.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) Global $run = False Global $string $files = _FileListToArray("morse_sound", "*.wav") Dim $sounds[UBound($files) - 1] For $i = 0 To UBound($sounds) - 1 $sounds[$i] = _SoundOpen("morse_sound\" & $files[$i], $files[$i]) Next $EzGUI = EzSkinGUICreate ("MyEzSkinDemo", 500, 300) $EzIcon = EzSkinIcon ($EzGUI) GUICtrlSetOnEvent($EzIcon[1], "close") GUICtrlSetOnEvent($EzIcon[2], "mini") $edit = _GUICtrlEdit_Create ($EzGUI, "Sample text", 60, 60, 380, 140, BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_MULTILINE)) $Button = EzSkinButton ("Start", 210, 210, 80, 25) GUICtrlSetOnEvent($Button, "start") GUISetState() While 1 EzSkinOver () If Not $run Then Sleep(50) Else $chars = StringSplit($string, "") For $i = 1 To UBound($chars) - 1 _GUICtrlEdit_SetSel ($edit, $i - 1, $i) If $chars[$i] = " " Or $chars[$i] = @CR Or $chars[$i] = @LF Then Sleep(360) Else _SoundPlay($chars[$i] & "_morse_code.wav", 1) _SoundSeek($chars[$i] & "_morse_code.wav", 0, 0, 0) Sleep(270) EndIf Next $run = False _GUICtrlEdit_SetSel ($edit, 0, 0) EndIf WEnd Func start() $string = StringUpper(_GUICtrlEdit_GetText ($edit)) $run = True ControlClick("Morse Code", "", $edit) EndFunc ;==>start Func close() Exit EndFunc ;==>close Func mini() GUISetState(@SW_MINIMIZE, $EzGUI) EndFunc ;==>mini #endregion All thats needed is EzSkin.... http://www.autoitscript.com/forum/index.ph...st&p=307380 8) Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 Cool Never heard of EzSkin before looks great Especially the button looks cool. This turned out to be a great way of learning morse btw. Better than I expected. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 Hey Val, I get an error when trying to use the modded code: "The $ESkin_folder" wasn't found". What to do? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
NewBooty Posted May 2, 2008 Share Posted May 2, 2008 you gotta get teh ez folder in the topic of ezskin/xskin and then put the var where u have it Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 you gotta get teh ez folder in the topic of ezskin/xskin and then put the var where u have itEhm what? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
NewBooty Posted May 2, 2008 Share Posted May 2, 2008 do a forum search 4 ezskin or xskin and get teh skin folder dat comes wit it. and then in da script set da varable to dat folder Link to comment Share on other sites More sharing options...
GtaSpider Posted May 2, 2008 Share Posted May 2, 2008 Hi Nice Script But its bad, that you had to play soundfiles. They are too big.. Here is a Code with the function "Beep": expandcollapse popup#include<GuiEdit.au3> #include<EditConstants.au3> #include<GUIConstantsEx.au3> ; Author monoceres and GtaSpider, source wikipedia Opt("GUIOnEventMode", 1) Global $run = False,$string $win = GUICreate("Morse Code", 400, 200) $edit = _GUICtrlEdit_Create($win, "SOS", 10, 10, 380, 140, BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_MULTILINE)) $hStart = GUICtrlCreateButton("Start", 180, 160, 40, 25) GUICtrlSetOnEvent(-1, "start") GUISetOnEvent(-3, "close") GUISetState() While 1 If Not $run Then Sleep(50) Else GUICtrlSetState($hStart,$GUI_DISABLE) $chars = StringSplit($string, "") For $i = 1 To UBound($chars) - 1 _GUICtrlEdit_SetSel($edit, $i - 1, $i) If $chars[$i] = " " Or $chars[$i] = @CR Or $chars[$i] = @LF Then Sleep(360) Else _PlayMorse($chars[$i]) Sleep(270) EndIf Next GUICtrlSetState($hStart,$GUI_ENABLE) GUICtrlSetData($hStart,"Start") $run = False _GUICtrlEdit_SetSel($edit, 0, 0) EndIf WEnd Func start() $string = StringUpper(_GUICtrlEdit_GetText($edit)) $run = True ControlClick("Morse Code", "", $edit) EndFunc ;==>start Func close() Exit EndFunc ;==>close Func _PlayMorse($sChar) Local $aSS = StringSplit(FileRead("Morse.audb"), @CRLF,1), $i, $sMorse For $i = 1 To $aSS[0] If StringLeft($aSS[$i], 1) = $sChar Then $sMorse = StringTrimLeft($aSS[$i], 1) Next If Not StringLen($sMorse) Then Return 0 GUICtrlSetData($hStart,$sMorse) $aSS = StringSplit($sMorse, "") For $i = 1 To $aSS[0] If $aSS[$i] = "." Then $iDealy = 250 Else $iDealy = 250*2 EndIf Beep(600,$iDealy) Sleep(10) Next EndFunc All what you need is the file "Morse.audb". Its in the Attachment in the ZIP! Your SpiderMorse_Code_500x_smaler___ReUPP_by_Spider.zip www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Author Share Posted May 2, 2008 Hi Nice Script But its bad, that you had to play soundfiles. They are too big.. Here is a Code with the function "Beep": expandcollapse popup#include<GuiEdit.au3> #include<EditConstants.au3> #include<GUIConstantsEx.au3> ; Author monoceres and GtaSpider, source wikipedia Opt("GUIOnEventMode", 1) Global $run = False,$string $win = GUICreate("Morse Code", 400, 200) $edit = _GUICtrlEdit_Create($win, "SOS", 10, 10, 380, 140, BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_MULTILINE)) $hStart = GUICtrlCreateButton("Start", 180, 160, 40, 25) GUICtrlSetOnEvent(-1, "start") GUISetOnEvent(-3, "close") GUISetState() While 1 If Not $run Then Sleep(50) Else GUICtrlSetState($hStart,$GUI_DISABLE) $chars = StringSplit($string, "") For $i = 1 To UBound($chars) - 1 _GUICtrlEdit_SetSel($edit, $i - 1, $i) If $chars[$i] = " " Or $chars[$i] = @CR Or $chars[$i] = @LF Then Sleep(360) Else _PlayMorse($chars[$i]) Sleep(270) EndIf Next GUICtrlSetState($hStart,$GUI_ENABLE) GUICtrlSetData($hStart,"Start") $run = False _GUICtrlEdit_SetSel($edit, 0, 0) EndIf WEnd Func start() $string = StringUpper(_GUICtrlEdit_GetText($edit)) $run = True ControlClick("Morse Code", "", $edit) EndFunc ;==>start Func close() Exit EndFunc ;==>close Func _PlayMorse($sChar) Local $aSS = StringSplit(FileRead("Morse.audb"), @CRLF,1), $i, $sMorse For $i = 1 To $aSS[0] If StringLeft($aSS[$i], 1) = $sChar Then $sMorse = StringTrimLeft($aSS[$i], 1) Next If Not StringLen($sMorse) Then Return 0 GUICtrlSetData($hStart,$sMorse) $aSS = StringSplit($sMorse, "") For $i = 1 To $aSS[0] If $aSS[$i] = "." Then $iDealy = 250 Else $iDealy = 250*2 EndIf Beep(600,$iDealy) Sleep(10) Next EndFunc All what you need is the file "Morse.audb". Its in the Attachment in the ZIP! Your Spider This is exactly like open source should work, everyone making improvements I actually thought of beeping the morse but I cannot stand the sound, I gave a friend the super mario beep song and he looped it and played it for hoooours on a LAN we went on Maybe make a compromise with only two sound files, long and short? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2008 Share Posted May 3, 2008 Hey Val, I get an error when trying to use the modded code: "The $ESkin_folder" wasn't found". What to do? Use this zip with everything 8) Link to comment Share on other sites More sharing options...
monoceres Posted May 3, 2008 Author Share Posted May 3, 2008 (edited) Use this zip with everything 8)Thanks, but I noticed that the highlightning was gone, why is that? Edit: Nevermind it was because you changed the title of the window Edited May 3, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 10, 2008 Share Posted November 10, 2008 My version adds some procodes and flashes the NUMLOCK light with the beep: _SendMorse() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dansxmods Posted November 11, 2008 Share Posted November 11, 2008 (edited) For some reason the version without the sound files does not have sound for me. It is because the beep function does not work on my pc for some reason. Edited November 11, 2008 by dansxmods Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 20, 2022 Moderators Share Posted February 20, 2022 roseramms, Welcome to the AutoIt forums. But I feel you would be better served by asking this question on an amateur radio forum as I am not sure many here will have had any experience of using Morse code "for real". In my own case, I had to learn it to identify radio beacons - but most of the time you already knew the code you expected to hear and by definition the code repeated at regular intervals - although I seem to remember that the exam only repeated the code once (it was nearly 50 years ago)! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now