Sign in to follow this  
Followers 0
rush4hire

Need a command system.

7 posts in this topic

Say your in some game like Warcraft III or some other game, and you want to trigger functions in an autoit script.

So you would have a trigger like maybe ! or something.

This would be at the beginning of your message.

Was stuff removed to prevent using AutoIt for a keylogger?

If so I guess you would have to do this entirely with HotKeySet ( "key" [, "function"] )

One HotKey would be for trigger, then when that was used it would set other things for hotkeys?

And would send them when they where used. So you could see your command to make sure it was right.

I'm just guessing.

Unless I missed something. Cause I can't find anything else that will respond to keypresses.

Anyhow thanks. :D

Share this post


Link to post
Share on other sites



HotKeySet is what yuo are looking for, as far as I know.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

IsPressed

?!

:D

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Use AutoIt BETA.

#Include <Misc.au3>

_IsPressed($s_hexKey[, $v_dll = 'user32.dll'])

EDIT: Add 'Function Reference'

Edited by Briegel

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Oh this is in beta ?

In user defined functions ?

Aright I'll check that out. Thanks. :D

Found it.

Might copy just this function though:

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
; $hexKey must be the value of one of the keys.
; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is.
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc  ;==>_IsPressed

rather than including all the stuff in misc.au3 that I won't be using.

Edited by rush4hire

Share this post


Link to post
Share on other sites

This is really messy. I wish you could just get the keys users press like scriptWriter does.

I might have to start learning C++ or something.

Here's a section of code to enter a numeric game code from a game.

It's very slow and sticky and if you go too fast it messes up and the numbers come out in the wrong order.

Global $code_string

; primary trigger sets everything up.
; we'll use numbers and number pad numbers as well.
; need backspace, -, and enter
Func initManEnter()
    $code_string = ""
HotKeySet("{NUMPADENTER}","ManEnterKey")
HotKeySet("{ENTER}","ManEnterKey")
HotKeySet("{BS}","ManEnterKey")
HotKeySet("-","ManEnterKey")
HotKeySet("{NUMPADSUB}","ManEnterKey")
For $i = 0 to 9
    HotKeySet(String($i), "ManEnterKey")
    HotKeySet("{NUMPAD"&$i&"}", "ManEnterKey")
Next
SoundPlay(@WindowsDir & "\media\ding.wav")
EndFunc


; These are all hotkeys to enter your code from the game.
; It's so slow and sticky. You have to make yourself pause while entering the code.
;   If you have big processing running.
Func ManEnterKey()
$x = @HotKeyPressed
HotKeySet($x)
Send($x)
HotKeySet($x, "ManEnterKey")

; hit enter to undo all the temp hotkeys and enter 
;  the text you just typed with only numbers.
If $x == "{NUMPADENTER}" or $x == "{ENTER}" Then
    HotKeySet("{NUMPADENTER}")
    HotKeySet("{ENTER}")
    HotKeySet("{BS}")
    HotKeySet("-")
    HotKeySet("{NUMPADSUB}")
    For $i = 0 to 9
        HotKeySet(String($i))
        HotKeySet("{NUMPAD"&$i&"}")
    Next
    
    ; user defined function in another part of this script.
    ; nothing to do with this topic
    ddResponseSound(manEnterCode( $code_string ))
Else
    
    ;  if it's number, nothing special
    ; if it's backspace . error if nothing to delete or parse the text to delete.
    ; if it's {NUMPADSUB} this means -
    ; so we keep adding to our text and making beep sounds till user hits enter.
    If StringLen($x) == 1 Then
    ElseIf $x == "{BS}" Then
        If $code_string == "" Then
            SoundPlay(@WindowsDir & "\media\chord.wav")
            Return
        Else
            $code_string = StringLeft($code_string, StringLen($code_string)-1)
            $x = ""
        EndIf
    ElseIf $x == "{NUMPADSUB}" Then
        $x = "-"
    Else
        $x = StringMid($x,8,1)
    EndIf
    $code_string &= $x
    Beep(350, 8)
    ;~ ya right. This SoundPlay slowed me down too much. We can only beep for 8 milliseconds
    ; which is little tick.
;   SoundPlay(@WindowsDir & "\media\start.wav")
EndIf
    
EndFunc
oÝ÷ Ø    ÝêÞßÛazº'y«­¢+Ø(ìÍÐÑ¡¹ÕµÈ½¥¹Ù¹Ñ½Éä½áÌѼͱ°½ÈɽÀ¥ÑµÌ(ì¡Éå½Ô¡¥Ð̽Èܽ¹Ñ¡¸¹ÕµÈ¸)Õ¹Íѹյ½½áÌ ¤($ÀÌØíàô!½Ñ-åAÉÍÍ(%%ÀÌØíàôôÅÕ½ÐíìÅÕ½ÐìµÀìÀÌØíÍÑ}¡½Ñ­åÍlÍtµÀìÅÕ½ÐíôÅÕ½ÐìQ¡¸($%½ÈÀÌØí¤ôÄѼØ($$%!½Ñ-åMСÍÑÉ¥¹ ÀÌØí¤¤°ÅÕ½ÐíÍѹյ½½áÌÅÕ½Ðì¤($%9áÐ(%±Í($$ÀÌØí¹Õµ½Í±½ÑÌô¹ÕµÈ ÀÌØíà¤($%½ÈÀÌØí¤ôÄѼØ($$%!½Ñ-åMСÍÑÉ¥¹ ÀÌØí¤¤¤($%9áÐ(%¹%)¹Õ¹

But it's not a huge concern.

Now I have to make a hotkey changer, so if you are in a game you can hit like F4 or w/e, then the hotkey you want, then the key(s) to assign to that hotkey, then hit F4 again.

The F4 part would be adjustable in the GUI.

Like this GUI

%7Boption%7Dhttp://www.rush4hire.com/examples1/ddcodes11gui.jpg%7Boption%7D

I'm just hoping to find a better way..

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