Sign in to follow this  
Followers 0
NoobBK

Send() can't simulated keystrokes. Bug ?

3 posts in this topic

HotKeySet("^1","Set")

While 1

Sleep(100)

WEnd

Func Set()

Send("{F8}")

EndFunc

I write a script to auto press F8 in Gunbound ( www.gunbound.net ), but it can't simulated keystrokes B) Why ?

Share this post


Link to post
Share on other sites



no bug... ver 3.1.1.83 beta

this worked with running notepad...then sending the help "F1" key and it works

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F8}", "ShowHelp")  

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowHelp()
    Run("Notepad.exe")
    Sleep(2000)
    Send("{F1}")
    MsgBox(4096,"","This is a message.")
EndFunc

there are many reasons why your script may not work, however the problem is not in Autoit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Welcome to the forums!

Games generally require a longer keypress. Try increasing the key down delay:

; Try 100 or larger if it still doesn't work
Opt('SendKeyDownDelay', 50)
HotkeySet('^1', 'Set')

While 1
   ; P.S. Longer Sleeps() are better when in a loop doing nothing
    Sleep(0x7FFFFFFF)
WEnd

Func Set()
    Send('{F8}')
EndFunc

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