Jump to content

Ezzetabi's translator.


ezzetabi
 Share

Recommended Posts

Here ya go!:

$test= Inputbox ("Ezzetabi's Translator", "This is a BETA of Ezzetabi's translator, type anything:")

$test = $test

$test = _4lter($test)

MsgBox(0,'',$test)


Func _4lter($sText)
$aOriginal = StringSplit(StringReplace('Q;W;E;R;T;Y; U;I;O;P;A;S;D;F;G; H;J;K;L; Z;'_
       & 'X;C;V;B; N;  M;q;w;e;r;t;y;u;i;o;p;a;s;d;f;g;h;j;k;l;z;x;c;v;b;n;m',' ',''),';')
$a041tered = StringSplit(StringReplace('Q;VV;3;®;7;¥;|_|;1;();|³;4;§;|);F;6;|-|;J;|<;|_;~/_;'_
       & '><;Ç;\%;ß;/\/;|\/|;q;w;ë;r;t;µ;µ;¡;ø;|>;ð;s;Þ;;9;h;];k;|;z;×;¢;v;þ;n;m',' ',''),';')

For $c = 1 to $aOriginal[0]
  $sText = StringReplace($sText,$aOriginal[$c], $a041tered[$c],0,1)
Next
Return $sText
EndFunc

Maybe you should add a nice GUI interface =)

FootbaG
Link to comment
Share on other sites

That's why Im going to hang onto it until she makes hers... Unless she wants the code, she can have it =) I'm not just going to go posting it up for her, I'm just making it now because I'm bored =P But I won't post it.

FootbaG
Link to comment
Share on other sites

That's why Im going to hang onto it until she makes hers... Unless she wants the code, she can have it =) I'm not just going to go posting it up for her, I'm just making it now because I'm bored =P But I won't post it.

<{POST_SNAPBACK}>

:) Snce when is Ezzetabi a girl? :)
Link to comment
Share on other sites

I dropped the lossy idea of string replacing all characters, since a guy that actually write probably don't alters each and every character at the same way.

This time, it is much more random, many characters have more than one translation and they also may not translated at all! (a may become @ or 4 or stay a e.g.)

I think the result is much more credible, and also nice.

If you want to make a new line use a /n in C style. <- NEW!

$msg = InputBox(_4lter('Write!'), _4lter('Write your sentence.'))
If @error Then Exit

$msg = _4lter($msg)

ClipPut($msg)
;MsgBox(0, '', $msg)

Func _4lter($sText)
   Local $const = .6;Set here how much do you want to modify the string, from 0(never) to 1(always)
   
   
   Local $aOriginal, $a041tered, $c, $l = 1, $i, $aChars, $sOutPut = '', $f = 1
   $aOriginal = StringSplit(StringReplace('?;CE;AE;ae;Q;V  ;E;R;T;Y;  U;I;O   ;P; A;' & _
         'S;D;F;G; H;J; K;L; Z;X;C;W; B; N;     M      ;q;w ;e;r;t;y;u;i;o;p;a;' & _
         's;d;f;g;h;j;k ;l;z;x;c;v;b;n;m', ' ', ''), ';')
   $a041tered = StringSplit(StringReplace('¿;Œ;Æ;   æ;Q;\%,\/;3,€;®;7;¥;|_|;1;Ø,(),0;|³;4,@;' & _
         '§;|);F;6;|-|;J;|<;|_;~/_;><;Ç;VV;ß;/\/,|\|;|\/|,/\/\;q;w,vv;ë,3;r;†;µ,¥;ù,µ;i;ø,0;|>;ð,4;' & _
         's,§;Þ;ƒ;9;h;];k,1<;|,1;z;×;¢,ç;v;þ;n;m', ' ', ''), ';')
   
   $sText = StringReplace($sText,'\n',@crlf)
   While $l <= StringLen($sText)
      $f = 0
      If Random() < $const Then
         $f = 0
         For $c = 1 To $aOriginal[0]
            $i = StringLen($aOriginal[$c])
            If StringMid($sText, $l, $i) == $aOriginal[$c] Then
               If StringInStr($a041tered[$c], ',') Then
                  $aChar = StringSplit($a041tered[$c], ',')
                  $sOutPut = $sOutPut & $aChar[Int(Random(1, $aChar[0] + 1)) ]
               Else
                  $sOutPut = $sOutPut & $a041tered[$c]
               EndIf
               $l = $l + $i
               $f = 1
            EndIf
            If $f = 1 Then ExitLoop
         Next
      EndIf
      
      If $f = 0 Then
         $sOutPut = $sOutPut & StringMid($sText, $l, 1)
         $l = $l + 1
      EndIf
   Wend
   
   Return $sOutPut
EndFunc  ;==>_4lter

Ok, the code may seems a little harder to read... Bear with it.

Edited by ezzetabi
Link to comment
Share on other sites

Hey! That's pretty cool. I like how it replaces it with different characters... Except using the inputbox you provided doesn't work, so heres something that works. Same thing, just a different inputbox:

$hey= InputBox ("Ezzetabi's Translator", "Write a sentence to translate:")
$hi= _4lter($hey)
MsgBox (0, "Translated Text:", $hi) 


Func _4lter($sText)
  Local $const = .6;Set here how much do you want to modify the string, from 0(never) to 1(always)
  
  
  Local $aOriginal, $a041tered, $c, $l = 1, $i, $aChars, $sOutPut = '', $f = 1
  $aOriginal = StringSplit(StringReplace('?;CE;AE;ae;Q;V  ;E;R;T;Y;  U;I;O   ;P; A;' & _
        'S;D;F;G; H;J; K;L; Z;X;C;W; B; N;     M      ;q;w ;e;r;t;y;u;i;o;p;a;' & _
        's;d;f;g;h;j;k ;l;z;x;c;v;b;n;m', ' ', ''), ';')
  $a041tered = StringSplit(StringReplace('¿;;Æ;   æ;Q;\%,\/;3,;®;7;¥;|_|;1;Ø,(),0;|³;4,@;' & _
        '§;|);F;6;|-|;J;|<;|_;~/_;><;Ç;VV;ß;/\/,|\|;|\/|,/\/\;q;w,vv;ë,3;r;;µ,¥;ù,µ;i;ø,0;|>;ð,4;' & _
        's,§;Þ;;9;h;];k,1<;|,1;z;×;¢,ç;v;þ;n;m', ' ', ''), ';')
  
  
  While $l <= StringLen($sText)
     $f = 0
     If Random() < $const Then
        $f = 0
        For $c = 1 To $aOriginal[0]
           $i = StringLen($aOriginal[$c])
           If StringMid($sText, $l, $i) == $aOriginal[$c] Then
              If StringInStr($a041tered[$c], ',') Then
                 $aChar = StringSplit($a041tered[$c], ',')
                 $sOutPut = $sOutPut & $aChar[Int(Random(1, $aChar[0] + 1)) ]
              Else
                 $sOutPut = $sOutPut & $a041tered[$c]
              EndIf
              $l = $l + $i
              $f = 1
           EndIf
        Next
     EndIf
     
     If $f = 0 Then
        $sOutPut = $sOutPut & StringMid($sText, $l, 1)
        $l = $l + 1
     EndIf
  Wend
  
  Return $sOutPut
EndFunc ;==>_4lter

I think I will use this on my friends and send a whole letter to them =P Hehe

Good work

FootbaG
Link to comment
Share on other sites

Pretty silly, but fun...

$aList = WinList()

For $c = 1 to $aList[0][0]
   If $aList[$c][0] <> '' Then
      WinSetTitle($aList[$c][1],'',_4lter($aList[$c][0]))
   EndIf
Next

You need the lastest unstable to try this out.

I'd like to add this feature in a undocumentated !command in Run!, do you think is an interesting easter egg?

Link to comment
Share on other sites

GUI version...

#include <GUIConstants.au3>
Opt ('MustDeclareVars', 1)

Global $Const = .6
Dim $msg, $style, $ctrInput, $ctrSlider, $ctrQuit, $ctrTran, $ctrClip, $sInput

GUICreate("Ezzetabi's traslator", 500, 400)
$style = $ES_WANTRETURN + $WS_VSCROLL + $WS_HSCROLL + $ES_AUTOVSCROLL + $ES_AUTOHSCROLL + $ES_NOHIDESEL + $ES_MULTILINE
$ctrInput = GUICtrlCreateInput('', 1, 1, 498, 378, $style)

$ctrSlider = GUICtrlCreateSlider(1, 379, 80, 20)
GUICtrlSetLimit($ctrSlider, 10, 1)
GUICtrlSetData($ctrSlider, 6)
GUICtrlCreateLabel('Set how much you want altering the text.', 81, 383, -1, -1)

$ctrQuit = GUICtrlCreateButton('&Quit', 444, 380, 55, 20)
$ctrTran = GUICtrlCreateButton('&Translate', 389, 380, 55, 20)
$ctrClip = GUICtrlCreateButton('&Copy2Clip', 334, 380, 55, 20)

GUISetState(@SW_SHOW)
While 1
   $msg = GUIGetMsg()
   
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $ctrQuit
         ExitLoop
      Case $msg = $ctrSlider
         $Const = GUIRead($ctrSlider) / 10
      Case $msg = $ctrTran
         GUICtrlSetState($ctrTran, $GUI_DISABLE)
         GUICtrlSetState($ctrInput, $GUI_DISABLE)
         
         $sInput = _4lter(GUIRead($ctrInput))
         GUICtrlSetData($ctrInput, $sInput)
         
         GUICtrlSetState($ctrTran, $GUI_ENABLE)
         GUICtrlSetState($ctrInput, $GUI_ENABLE)
      Case $msg = $ctrClip
         ClipPut($sInput)
   EndSelect
Wend

Exit
Func _4lter($sText)
  ;$Const is global
   
   Local $aOriginal, $a041tered, $c, $l = 1, $i, $aChar, $sOutPut = '', $f = 1
   $aOriginal = StringSplit(StringReplace('?;CE;AE;ae;Q;V  ;E;R;T;Y;  U;I;O   ;P; A;' & _
         'S;D;F;G; H;J; K;  L; Z;X;C;W; B; N;     M      ;q;w ;e;r;t;y;u;i;o;p;a;' & _
         's;d;f;g;h;j;k ;l;z;x;c;v;b;n;m', ' ', ''), ';')
   $a041tered = StringSplit(StringReplace('¿;Œ;Æ;   æ;Q;\%,\/;&,3,€;®;7;¥;|_|;1;Ø,(),0;|³;4,@;' & _
         '§;|),Ð;F;6;|-|;J;|<;|_;~/_,Ž;><;Ç;VV;ß;/\/,|\|,Ñ;|\/|,/\/\;q;w,vv;ë,3;r;†;µ,¥;ù,µ;i;ø,0;|>;ð,4;' & _
         's,§;Þ;ƒ;9;h;];k,1<;|,1;z;×;©,¢,ç;v;þ;ñ;m', ' ', ''), ';')
   
   While $l <= StringLen($sText)
      $f = 0
      If Random() < $Const Then
         $f = 0
         For $c = 1 To $aOriginal[0]
            $i = StringLen($aOriginal[$c])
            If StringMid($sText, $l, $i) == $aOriginal[$c] Then
               If StringInStr($a041tered[$c], ',') Then
                  $aChar = StringSplit($a041tered[$c], ',')
                  $sOutPut = $sOutPut & $aChar[Int(Random(1, $aChar[0] + 1)) ]
               Else
                  $sOutPut = $sOutPut & $a041tered[$c]
               EndIf
               $l = $l + $i
               $f = 1
            EndIf
            If $f = 1 Then ExitLoop
         Next
      EndIf
      
      If $f = 0 Then
         $sOutPut = $sOutPut & StringMid($sText, $l, 1)
         $l = $l + 1
      EndIf
   Wend
   
   Return $sOutPut
EndFunc  ;==>_4lter
Link to comment
Share on other sites

Another GUI version... I was going to post it but you beat me to it!

Anyways, here:

#include <GUIConstants.au3>

GUICreate("_4lter GUI Version", 530, 225, (@DesktopWidth - 757) / 2, (@DesktopHeight - 262) / 2, 0x04CF0000)

$edit = GUICtrlCreateEdit("", 5, 5, 520, 190, 0x00200000)
$alter = GUICtrlCreateButton("Alter", 5, 200, 70, 20)
$copy = GUICtrlCreateButton("Copy to Clipboard", 75, 200, 130, 20)

GUISetState()

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      Exit
    Case $msg = $copy
      ClipPut(GUIRead($edit))
    Case $msg = $alter
      $text = _4lter(GUIRead($edit))
      GUICtrlSetData($edit, "")
      GUICtrlSetData($edit, $text)
  EndSelect
Wend

Func _4lter($sText)
  Local $const = .6;Set here how much do you want to modify the string, from 0(never) to 1(always)
  
  
  Local $aOriginal, $a041tered, $c, $l = 1, $i, $aChars, $sOutPut = '', $f = 1
  $aOriginal = StringSplit(StringReplace('?;CE;AE;ae;Q;V ;E;R;T;Y;  U;I;O  ;P; A;' & _
        'S;D;F;G; H;J; K;L; Z;X;C;W; B; N;     M     ;q;w;e;r;t;y;u;i;o;p;a;' & _
        's;d;f;g;h;j;k;l;z;x;c;v;b;n;m', ' ', ''), ';')
  $a041tered = StringSplit(StringReplace('¿;;Æ;   æ;Q;\%,\/;3,;®;7;¥;|_|;1;Ø,(),0;|³;4,@;' & _
        '§;|);F;6;|-|;J;|<;|_;~/_;><;Ç;VV;ß;/\/,|\|;|\/|,/\/\;q;w,vv;ë,3;r;;µ,¥;ù,µ;i;ø,0;|>;ð,4;' & _
        's,§;Þ;;9;h;];k,1<;|,1;z;×;¢,ç;v;þ;n;m', ' ', ''), ';')
  
  $sText = StringReplace($sText,'\n',@crlf)
  While $l <= StringLen($sText)
     $f = 0
     If Random() < $const Then
        $f = 0
        For $c = 1 To $aOriginal[0]
           $i = StringLen($aOriginal[$c])
           If StringMid($sText, $l, $i) == $aOriginal[$c] Then
              If StringInStr($a041tered[$c], ',') Then
                 $aChar = StringSplit($a041tered[$c], ',')
                 $sOutPut = $sOutPut & $aChar[Int(Random(1, $aChar[0] + 1)) ]
              Else
                 $sOutPut = $sOutPut & $a041tered[$c]
              EndIf
              $l = $l + $i
              $f = 1
           EndIf
           If $f = 1 Then ExitLoop
        Next
     EndIf
     
     If $f = 0 Then
        $sOutPut = $sOutPut & StringMid($sText, $l, 1)
        $l = $l + 1
     EndIf
  Wend
  
  Return $sOutPut
EndFunc ;==>_4lter
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...