Jump to content

Recommended Posts

Posted

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.

#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]

Posted

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... :D 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]

Posted

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]

Posted

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 :D

[center][/center][center]=][u][/u][/center][center][/center]

Posted (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, :D

Edited by IchBistTod

[center][/center][center]=][u][/u][/center][center][/center]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...