IchBistTod Posted August 30, 2009 Share Posted August 30, 2009 YOU MUST COMPILE TO CUI NOT GUI This script will convert text to morse code then beep it out, showing the beeps(long and short) as it goes. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Matrix.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_Comment=Text To Morse Code Converter #AutoIt3Wrapper_Res_Description=Text To Morse Code Converter #AutoIt3Wrapper_Res_Fileversion=0.0.0.1 #AutoIt3Wrapper_Res_Language=1033 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #NoTrayIcon if $cmdline[0] <> 0 Then _MorseCodeToAudio(_stringtomorsecode($cmdlineraw)) Else while 1 _MorseCodeToAudio(_stringtomorsecode(_consoleread(">"))) wend EndIf Func _stringtomorsecode($string) $String = stringSplit($string, "") $return = "" for $i=1 to $string[0] switch $string[$i] Case "a" $return &=".- " Case "b" $return &="-... " Case "c" $return &="-.-. " Case "d" $return &="-.. " Case "e" $return &=". " Case "f" $return &="..-. " Case "g" $return &="--. " Case "h" $return &=".... " Case "i" $return &=".. " Case "j" $return &=".--- " Case "k" $return &="-.- " Case "l" $return &=".-.. " Case "m" $return &="-- " Case "n" $return &="-. " Case "o" $return &="--- " Case "p" $return &=".--. " Case "q" $return &="--.- " Case "r" $return &=".-. " Case "s" $return &="... " Case "t" $return &="- " Case "u" $return &="..- " Case "v" $return &="...- " Case "w" $return &=".-- " Case "x" $return &="-..- " Case "y" $return &="-.-- " Case "z" $return &="--.. " Case "1" $return &=".---- " Case "2" $return &="..--- " Case "3" $return &="...-- " Case "4" $return &="....- " Case "5" $return &="..... " Case "6" $return &="-.... " Case "7" $return &="--... " Case "8" $return &="---.. " Case "9" $return &="----. " Case "0" $return &="----- " Case " " $return = StringTrimright($return, 1)&"/" EndSwitch Next return $return endfunc func _MorseCodeToAudio($code) $string =StringSplit($code, "") for $i=1 to $string[0] $beep = $string[$i] switch $beep case "." ConsoleWrite(".") beep(701, 80) sleep(80) case "-" ConsoleWrite("-") beep(701, 240) sleep(80) case " " sleep(240) case "/" ConsoleWrite(" ") sleep(560) EndSwitch Next EndFunc Func _consoleread($text) $input = "" ConsoleWrite(@CRLF & $text) $file = FileOpen("con", 4) While 1 $chr = FileRead($file, 1) If $chr = @LF Then ExitLoop $input = $input & BinaryToString($chr) WEnd FileClose($file) Return StringReplace(StringReplace($input, @LF,""), @CR,"") EndFunc [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
trancexx Posted August 30, 2009 Share Posted August 30, 2009 I like it. I see you have a small glitch around line 118 (or something like that). You likely meant: ;... Case " " ConsoleWrite(" ") Sleep(240) Case "/" ConsoleWrite(" / ") Sleep(560) EndSwitch Right? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
IchBistTod Posted August 30, 2009 Author Share Posted August 30, 2009 I dont believe so, because i think a / in morse code is a line break, so i think it shoulda been a @LF although im not sure. Wrote it like 2 months ago... mess arroudn with it and see what seems right if you wish ad post updated code. But for me its worked fine as is. [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
Kip Posted August 30, 2009 Share Posted August 30, 2009 How am I supposed to compile this? Because #AutoIt3Wrapper_Change2CUI=y gives an error: Invalid Compiler directive MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Zedna Posted August 30, 2009 Share Posted August 30, 2009 Nice script! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
IchBistTod Posted August 31, 2009 Author Share Posted August 31, 2009 make sure you have the latest scite, and autoit, and chose to compile with options. that should compile it to a command line app, which is required. [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
jvanegmond Posted August 31, 2009 Share Posted August 31, 2009 Reminds me of the movie Transformers where they use a old computer to send morse codes to the ministry of defence. : ) github.com/jvanegmond Link to comment Share on other sites More sharing options...
Kip Posted August 31, 2009 Share Posted August 31, 2009 Both 3.3.0.0 and the beta version 3.3.1.1 won't compile it to console. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
jvanegmond Posted August 31, 2009 Share Posted August 31, 2009 Both 3.3.0.0 and the beta version 3.3.1.1 won't compile it to console.It does compile to console.Open Aut2Exe v3, Browse for source file location. Tick the Console? checkbox and press Convert. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Kip Posted August 31, 2009 Share Posted August 31, 2009 ah, the Aut2Exe in the autoit folder is different than the one that SciTE launches. It works now. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
IchBistTod Posted August 31, 2009 Author Share Posted August 31, 2009 Reminds me of the movie Transformers where they use a old computer to send morse codes to the ministry of defence. : )that was my inspiration. lol [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
jvanegmond Posted August 31, 2009 Share Posted August 31, 2009 (edited) Haha, very good! I guess it can work, you just attach a cable to the whatever controls the computer speaker and you're done. : ) Edited August 31, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
IchBistTod Posted August 31, 2009 Author Share Posted August 31, 2009 (edited) I was considering how the fuck you would do that and i thought... im sure its possible somehow.... speaker wire to phone wire or some sh*t liek that, Edited August 31, 2009 by IchBistTod [center][/center][center]=][u][/u][/center][center][/center] 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