Jump to content

Recommended Posts

Posted

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 ?

Posted

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

Posted

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

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
×
×
  • Create New...