Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 18:57

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



autoit 3D strokes

Discussion on autoit 3D strokes within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2010
Posts: 1
Received Thanks: 0
autoit 3D strokes

hello people im trying to make a couple of bots into autoit but i havent been able to send the keystrokes to the 3d window, i tried on a notepad and it works the problems is with the game it self, i tried with send and the controlsend comand any ideas?
josh3028 is offline  
Old 06/10/2014, 15:14   #2
 
Paraly's Avatar
 
elite*gold: 27
Join Date: Sep 2009
Posts: 5,609
Received Thanks: 1,596
Try this UDF (it's not from me I just found it some time ago with google)

Code:
; #FUNCTION# ====================================================================================================================
; Name...........: SimulKey
; Description ...: Simulate a Key-Send to a specified handle in the Background
; Author ........: Felix Lehmann
; Modified.......: If you modify this Script, please enter your name here
; Remarks .......: -
; Related .......: -
; Parameters ....: $hwnd = Specified Window to Send to
; ...............: $key = Key or String to Send (If String $string have to be enabled [see $string])
; ...............: $string = Set this to 1 If your "$key" is a string
; ...............: $state = Set this to 'up' or 'down' if u want a special event | Default is press the Key 1 Time
; ...............: $delay = The delay to hold the key down
; Return Values .: 1 = Done | -1 = Couldn't load user32.dll
; Link ..........; -
; ===============================================================================================================================
Func SimulKey($hWnd, $key, $string = 0, $state = 'skip', $delay = 10)
    ;//Open DLL (user32)
    $user32 = DllOpen('user32.dll')
    If $user32 = -1 Then
        SetError(-1, 1, -1)
    EndIf

    ;//Handle Special Keys
    Switch StringLower($key)
        Case 'enter'
            $WM_ENTER = 0x0d
            $dCall = DllCall($user32, 'int', "MapVirtualKey", 'int', $WM_ENTER, 'int', 0)
            $lParam = BitOR(BitShift($dCall[0], -16), 1)
        Case 'space'
            $WM_SPACE = 0x20
            $dCall = DllCall($user32, 'int', "MapVirtualKey", 'int', $WM_SPACE, 'int', 0)
            $lParam = BitOR(BitShift($dCall[0], -16), 1)
        Case 'tab'
            $WM_TAB = 0x09
            $dCall = DllCall($user32, 'int', "MapVirtualKey", 'int', $WM_TAB, 'int', 0)
            $lParam = BitOR(BitShift($dCall[0], -16), 1)
            ;//Handle Standard Keys
        Case Else
            ;//Stringmode 1
            If $string = 1 Then
                $split = StringSplit($key, "")
                For $ctn = 1 To $split[0]
                    $split[$ctn] = Asc(StringLower($split[$ctn]))
                Next
                For $ctn = 1 To $split[0]
                    $dCall = DllCall($user32, 'int', "VkKeyScan", 'int', $split[$ctn])
                    $lParamAsc = DllCall($user32, 'int', "MapVirtualKey", 'int', $dCall[0], 'int', 0)
                    $lParam = BitOR(BitShift($lParamAsc[0], -16), 1)
                    $lUpParam = BitOR($lParam, 0xC0000000)
                    DllCall($user32, 'int', "PostMessage", 'hwnd', $hWnd, 'int', $WM_KEYDOWN, 'int', $dCall[0], 'int', $lParam)
                    Sleep($delay)
                    DllCall($user32, 'int', "PostMessage", 'hwnd', $hWnd, 'int', $WM_KEYUP, 'int', $dCall[0], 'int', $lUpParam)
                    Sleep(10)
                Next
                ;//Stringmode 0
            ElseIf $string = 0 Then
                $key = Asc(StringLower($key))
                $dCall = DllCall($user32, 'int', "VkKeyScan", 'int', $key)
                $lParamAsc = DllCall($user32, 'int', "MapVirtualKey", 'int', $dCall[0], 'int', 0)
                $lParam = BitOR(BitShift($lParamAsc[0], -16), 1)
            EndIf
    EndSwitch
    $lUpParam = BitOR($lParam, 0xC0000000)
    If $string = 0 Then
        Switch StringLower($state)
            Case 'skip'
                DllCall($user32, 'int', "PostMessage", 'hwnd', $hWnd, 'int', $WM_KEYDOWN, 'int', $dCall[0], 'int', $lParam)
                Sleep($delay)
                DllCall($user32, 'int', "PostMessage", 'hwnd', $hWnd, 'int', $WM_KEYUP, 'int', $dCall[0], 'int', $lUpParam)
            Case 'down'
                DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", $WM_KEYDOWN, "int", $dCall[0], "int", $lParam)
            Case 'up'
                DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", $WM_KEYUP, "int", $dCall[0], "int", $lParam)
        EndSwitch
    EndIf
    DllClose($user32)
    Return 1
EndFunc   ;==>SimulKey
Paraly is offline  
Reply


Similar Threads Similar Threads
[Question] Background mouse clicks/ keyboard strokes recorder
06/13/2022 - Conquer Online 2 - 4 Replies
I was wondering if anyone knows a mouse clicks/ keyboards strokes recorder which I am able to inject (maybe) into a process so that it plays back what I've recorded while the window is minimized (background). I am using JitBit Macro Recorder, it does everything well, except it only runs foreground. Let me know guys, thanks in advance.
!Different Strokes!Andenken an *Gary Coleman*
11/19/2010 - Movies & Series - 1 Replies
Liebe Moviesection. Da ich immer noch gerne alte Folgen von der Serie: Different Strokes gucke, wollte ich euch heute mal den gestorbenen Hauptdarsteller vorstellen. GARY COLEMAN: Gary Wayne Coleman (* 8. Februar 1968 in Zion, Illinois; † 28. Mai 2010 in Provo, Utah) war ein US-amerikanischer Schauspieler. Coleman war infolge einer entzündlichen Nierenerkrankung pathologisch kleinwüchsig, so dass er noch als erwachsener Mann das körperliche Erscheinungsbild eines Kindes besaß.



All times are GMT +1. The time now is 18:58.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.