Jump to content

1337 text translator with imagesearch


Recommended Posts

Ok so im trying to convert a 1337 text translator(Thanks AlmarM) to work with images. I got starting code already but it needs some fixing.

#include <GUIConstants.au3>
#include <ImageSearch.au3>
Dim $aWords[22] = ["a", "b", "c", "d", "e", "h","i", "k",  "l",  "m",  "n",  "o",  "p",  "q",  "r",  "s",  "t", "v",  "w",  "x",  "y", "z"]
$GUI = GUICreate("1337 Text Translator", 200, 90, -1, -1)
$Input = GUICtrlCreateInput("", 10, 60, 180, 20)
$Button = GUICtrlCreateButton("1337 My Text", 10, 30, 180, 25)
$Label = GUICtrlCreateLabel("", 10, 10, 180, 20)
GUISetState(@SW_SHOW)
HotKeySet("{F5}", "Imagesearch") 
HotKeySet("{F7}","_stop") 
Func Imagesearch() 
While 1
    $x1 = 0
    $y1 = 0
    $result = _ImageSearch($aWords & ".bmp",1,$x1,$y1,0)
    if $result=1 Then
        $string = StringReplace($string, "s.bmp", "s")
        $string = StringReplace($string, "a.bmp", "a")
        $string = StringReplace($string, "o.bmp", "o")
        $string = StringReplace($string, "i.bmp", "i")
        $string = StringReplace($string, "e.bmp", "e")
        $string = StringReplace($string, "l.bmp", "l")
        $string = StringReplace($string, "p.bmp", "p")
        $string = StringReplace($string, "t.bmp", "t")
        $string = StringReplace($string, "b.bmp", "b")
        $string = StringReplace($string, "c.bmp", "c")
        $string = StringReplace($string, "d.bmp", "d")
        $string = StringReplace($string, "h.bmp", "h")
        $string = StringReplace($string, "k.bmp", "k")
        $string = StringReplace($string, "m.bmp", "m")
        $string = StringReplace($string, "n.bmp", "n")
        $string = StringReplace($string, "q.bmp", "q")
        $string = StringReplace($string, "r.bmp", "r")
        $string = StringReplace($string, "v.bmp", "v")
        $string = StringReplace($string, "w.bmp", "w")
        $string = StringReplace($string, "x.bmp", "x")
        $string = StringReplace($string, "y.bmp", "y")
        $string = StringReplace($string, "z.bmp", "z")
        GUICtrlSetData($input, $string)
        Endif
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Button
        $string = GUICtrlRead($Input)
        $string = StringReplace($string, "s", "$")
        $string = StringReplace($string, "a", "4")
        $string = StringReplace($string, "o", "0")
        $string = StringReplace($string, "i", "!")
        $string = StringReplace($string, "e", "3")
        $string = StringReplace($string, "l", "|_")
        $string = StringReplace($string, "p", "|>")
        $string = StringReplace($string, "t", "7")
        $string = StringReplace($string, "b", "/3")
        $string = StringReplace($string, "c", "(")
        $string = StringReplace($string, "d", "[)")
        $string = StringReplace($string, "h", "]-[")
        $string = StringReplace($string, "k", "|<")
        $string = StringReplace($string, "m", "|v|")
        $string = StringReplace($string, "n", "/\/")
        $string = StringReplace($string, "q", "()_")
        $string = StringReplace($string, "r", "/2")
        $string = StringReplace($string, "v", "\/")
        $string = StringReplace($string, "w", "\/\/")
        $string = StringReplace($string, "x", "><")
        $string = StringReplace($string, "y", "`/")
        $string = StringReplace($string, "z", "7_")
        ControlSend("Example", "", "Edit1", $string)
    EndSelect
WEnd
Endfunc


 Func _stop() 
   While 1 
      Sleep(100) 
   WEnd 
EndFunc 

While 1 
sleep(10) 
WEnd

So could anyone fix that code?

Thanks.

Edited by bf2forlife
Link to comment
Share on other sites

  • 3 weeks later...

Well i took break from this script and im back. I have fixed the script but there are still some bugs.

here is the script.

#include <GUIConstants.au3>
#include <ImageSearch.au3>
Dim $aWords[22] = ["a", "b", "c", "d", "e", "h","i", "k",  "l",  "m",  "n",  "o",  "p",  "q",  "r",  "s",  "t", "v",  "w",  "x",  "y", "z"]
$GUI = GUICreate("1337 Text Translator", 200, 90, -1, -1)
$Input = GUICtrlCreateInput("", 10, 60, 180, 20)
$Button = GUICtrlCreateButton("1337 My Text", 10, 30, 180, 25)
$Label = GUICtrlCreateLabel("", 10, 10, 180, 20)
GUISetState(@SW_SHOW)
HotKeySet("{F5}", "start") 
HotKeySet("{F7}","_stop") 
Func start() 
    While 1
    $var = GUICtrlRead($input)
    $x1 = 0
    $y1 = 0
    $result = _ImageSearch("s.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "s")
        else
    $result = _ImageSearch("a.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "a")
        else
            $result = _ImageSearch("o.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "o")
        else
            $result = _ImageSearch("i.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "i")
        else
            $result = _ImageSearch("e.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "e")
        else
            $result = _ImageSearch("l.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "l")
        else
            $result = _ImageSearch("p.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "p")
        else
            $result = _ImageSearch("t.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "t")
        else
                    $result = _ImageSearch("b.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "b")
        else
                    $result = _ImageSearch("c.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var & "c")
        else
                    $result = _ImageSearch("d.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "d")
        else
                    $result = _ImageSearch("h.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input, $var & "h")
        else
                            $result = _ImageSearch("k.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "k")
        else
                            $result = _ImageSearch("m.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "m")
        else
                            $result = _ImageSearch("n.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "n")
        else
                            $result = _ImageSearch("q.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "q")
        else
                            $result = _ImageSearch("r.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "r")
        else
                            $result = _ImageSearch("v.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "v")
        else
                                    $result = _ImageSearch("w.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "w")
        else
                                    $result = _ImageSearch("x.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input, $var & "x")
        else
                                    $result = _ImageSearch("y.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "y")
        else
                                    $result = _ImageSearch("z.bmp",1,$x1,$y1,0)
    if $result=1 Then
        GUICtrlSetData($input,$var &  "z")
        Endif
        endif
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf

    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
            EndSelect
        $string = GUICtrlRead($Input)
        $string = StringReplace($string, "s", "$")
        $string = StringReplace($string, "a", "4")
        $string = StringReplace($string, "o", "0")
        $string = StringReplace($string, "i", "!")
        $string = StringReplace($string, "e", "3")
        $string = StringReplace($string, "l", "|_")
        $string = StringReplace($string, "p", "|>")
        $string = StringReplace($string, "t", "7")
        $string = StringReplace($string, "b", "/3")
        $string = StringReplace($string, "c", "(")
        $string = StringReplace($string, "d", "[)")
        $string = StringReplace($string, "h", "]-[")
        $string = StringReplace($string, "k", "|<")
        $string = StringReplace($string, "m", "|v|")
        $string = StringReplace($string, "n", "/\/")
        $string = StringReplace($string, "q", "()_")
        $string = StringReplace($string, "r", "/2")
        $string = StringReplace($string, "v", "\/")
        $string = StringReplace($string, "w", "\/\/")
        $string = StringReplace($string, "x", "><")
        $string = StringReplace($string, "y", "`/")
        $string = StringReplace($string, "z", "7_")
        Send($string)
        Send("{ENTER}")
        GUICtrlSetData($input,"")
    WEND
Endfunc


 Func _stop() 
   While 1 
      Sleep(100) 
   WEnd 
EndFunc 

While 1 
sleep(10) 
WEnd

Well the bug is that when i for example write "ad" then it starts sending 4 all the time, and not [) at all.

Link to comment
Share on other sites

  • 1 month later...

Very interesting script!!! I am new in AutoIt and i cannot tell u anything. But im working at script that will read text too :P

[size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]

Link to comment
Share on other sites

Just corrected part with FOR NEXT loop (not tested):

#include <GUIConstants.au3>
#include <ImageSearch.au3>

Dim $aWords[22] = ["a", "b", "c", "d", "e", "h", "i", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]

$GUI = GUICreate("1337 Text Translator", 200, 90, -1, -1)
$Input = GUICtrlCreateInput("", 10, 60, 180, 20)
$Button = GUICtrlCreateButton("1337 My Text", 10, 30, 180, 25)
$Label = GUICtrlCreateLabel("", 10, 10, 180, 20)
GUISetState(@SW_SHOW)

HotKeySet("{F5}", "Imagesearch")
HotKeySet("{F7}", "_stop")

Func Imagesearch()
    While 1
        $x1 = 0
        $y1 = 0
        For $i = 0 To 21
            $result = _ImageSearch($aWords[$i] & ".bmp", 1, $x1, $y1, 0)
            If $result = 1 Then
                $string = StringReplace($string, $aWords[$i] & ".bmp", $aWords[$i])
                GUICtrlSetData($Input, $string)
                ExitLoop
            EndIf
        Next
        $nMsg = GUIGetMsg()
        Select
            Case $nMsg = $GUI_EVENT_CLOSE
                Exit
            Case $nMsg = $Button
                $string = GUICtrlRead($Input)
                $string = StringReplace($string, "s", "$")
                $string = StringReplace($string, "a", "4")
                $string = StringReplace($string, "o", "0")
                $string = StringReplace($string, "i", "!")
                $string = StringReplace($string, "e", "3")
                $string = StringReplace($string, "l", "|_")
                $string = StringReplace($string, "p", "|>")
                $string = StringReplace($string, "t", "7")
                $string = StringReplace($string, "b", "/3")
                $string = StringReplace($string, "c", "(")
                $string = StringReplace($string, "d", "[)")
                $string = StringReplace($string, "h", "]-[")
                $string = StringReplace($string, "k", "|<")
                $string = StringReplace($string, "m", "|v|")
                $string = StringReplace($string, "n", "/\/")
                $string = StringReplace($string, "q", "()_")
                $string = StringReplace($string, "r", "/2")
                $string = StringReplace($string, "v", "\/")
                $string = StringReplace($string, "w", "\/\/")
                $string = StringReplace($string, "x", "><")
                $string = StringReplace($string, "y", "`/")
                $string = StringReplace($string, "z", "7_")
                ControlSend("Example", "", "Edit1", $string)
        EndSelect
    WEnd
EndFunc   ;==>Imagesearch


Func _stop()
    While 1
        Sleep(100)
    WEnd
EndFunc   ;==>_stop

While 1
    Sleep(10)
WEnd
Edited by Zedna
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...