Sign in to follow this  
Followers 0
thelex

Translator

6 posts in this topic

I need just a little help. i wan't to make a script that translates the text i write, while im writing it. EXAMPLE:

i press down "i" and on the screen(for example in MSN) the "i" becomes "1".

(Y34H, 1M M4K1NG 4 1337SP33K TR4NSL4T0R)

Just need a little example or what to do, as this is a very simple thing.

Share this post


Link to post
Share on other sites



I need just a little help. i wan't to make a script that translates the text i write, while im writing it. EXAMPLE:

i press down "i" and on the screen(for example in MSN) the "i" becomes "1".

(Y34H, 1M M4K1NG 4 1337SP33K TR4NSL4T0R)

Just need a little example or what to do, as this is a very simple thing.

Well it's a very simple thing to walk up stairs but getting a computer to do it is very difficult.

A simple way to do it would be to set a hot key for the characters you want to change, and the function for the hotkey can just Send the replacement character.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

<br />Well it's a very simple thing to walk up stairs but getting a computer to do it is very difficult.<br /><br />A simple way to do it would be to set a hot key for the characters you want to change, and the function for the hotkey can just Send the replacement character.<br />

<br /><br /><br />

How?

Share this post


Link to post
Share on other sites

<br /><br /><br />

How?

Like this

1. Look in help for HotKeySet. Study the examples and try them.

2. Look in the help file for Send. Study again.

3.Write your own version.

4. If you write something and after trying a few things you are stuck then come back for help.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#include <Misc.au3>
select
     case _ispressed("69") then;for the letter "i"
     sleep(100)
     send("1")

case [for other key]
endselect

don't know if the result is "i1", if this happen, send a {delete} before sleep()


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I modified the _WinAPI_SetWindowsHookEx function help example in the beta to do this.

You would have to install the beta, and "Run beta" to get it to work. You can do it with the current release too though, if you just fix up the _WinAPI functions to their matching DllCalls.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>

Opt('MustDeclareVars', 1)

Global $hHook, $hStub_KeyProc, $buffer = ""

_Main()

Func _Main()
    Local $hmod

    $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
    $hmod = _WinAPI_GetModuleHandle(0)
    $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)

    MsgBox(4096, "", "Click OK, then in notepad type away.. " & @LF & @LF & "Press Esc to exit script")

    Run("Notepad")
    WinWait("Untitled -")
    WinActivate("Untitled -")

    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>_Main

Func EvaluateKey($keycode)
    If (($keycode > 64) And ($keycode < 91)) _ ; a - z
            Or (($keycode > 96) And ($keycode < 123)) _ ; A - Z
            Or (($keycode > 47) And ($keycode < 58)) Then ; 0 - 9
        $buffer = Chr($keycode)
        Switch $buffer
            Case "e"
                Send("3")
                Return 1
            Case "i"
                Send("1")
                Return 1
            Case "t"
                Send("7")
                Return 1
            Case "a"
                Send("4")
                Return 1
            Case "o"
                Send("0")
                Return 1
        EndSwitch
    ElseIf ($keycode > 159) And ($keycode < 164) Then
        Return
    ElseIf ($keycode = 27) Then ; esc key
        Exit
    Else
        $buffer = ""
    EndIf
EndFunc   ;==>EvaluateKey

;===========================================================
; callback function
;===========================================================
Func _KeyProc($nCode, $wParam, $lParam)
    Local $tKEYHOOKS
    $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
    If $nCode < 0 Then
        Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    EndIf
    If $wParam = $WM_KEYDOWN Then
        If EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode")) = 1 Then
            Return 1
        EndIf
    Else
        Local $flags = DllStructGetData($tKEYHOOKS, "flags")
        Switch $flags
            Case $LLKHF_ALTDOWN
                ConsoleWrite("$LLKHF_ALTDOWN" & @LF)
            Case $LLKHF_EXTENDED
                ConsoleWrite("$LLKHF_EXTENDED" & @LF)
            Case $LLKHF_INJECTED
                ConsoleWrite("$LLKHF_INJECTED" & @LF)
            Case $LLKHF_UP
                ConsoleWrite("$LLKHF_UP: scanCode - " & DllStructGetData($tKEYHOOKS, "scanCode") & @TAB & "vkCode - " & DllStructGetData($tKEYHOOKS, "vkCode") & @LF)
        EndSwitch
    EndIf
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc   ;==>_KeyProc

Func OnAutoItExit()
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hStub_KeyProc)
EndFunc   ;==>OnAutoItExit
Edited by covaks

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  
Followers 0