Jump to content
Sign in to follow this  
bf2forlife

1337 text translator with imagesearch

Recommended Posts

bf2forlife

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

Share this post


Link to post
Share on other sites
hussert

Image Search ??

Could that be used to Auto Type Image Codes ?? :)

Just kidding :)

Nice Script though ... too bad Iam busy now to try fixing it ... :)

Share this post


Link to post
Share on other sites
bf2forlife

Someone? Or can you even do that?

Edited by bf2forlife

Share this post


Link to post
Share on other sites
bf2forlife

You want to replace the text with images? Why not output the result into HTML?

What u mean?

Share this post


Link to post
Share on other sites
bf2forlife

Well your GUI will have to expand if you want to replace the letters with images in the GUI so why not export it in HTML?

Might work, but i dont know how to do it :)

Share this post


Link to post
Share on other sites
bf2forlife

Mind to post example? my help file is bugging (not opening)

Edited by bf2forlife

Share this post


Link to post
Share on other sites
bf2forlife

Got it working, so what ur exactly want to do with HTML?

I understanded that u want write the result in .html file? But why?

Edited by bf2forlife

Share this post


Link to post
Share on other sites
bf2forlife

Its my first time i gotta bump second time before respond :)

Share this post


Link to post
Share on other sites
bf2forlife

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.

Share this post


Link to post
Share on other sites
Belfigor

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]

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
bf2forlife

the main problem is that it puts the first found letter in multiple times. I want it to only put it once and then search for diffrent letter, but even if it were fixed, what would happen if the word has 2 same letters?

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.