Jump to content

Autoit Press space same lenght as i did


Blindz
 Share

Recommended Posts

hi im trying to make program that will press the same time the Key space that i did i started my project but i dont know what do to now... here's my code

$dll = DllOpen("user32.dll")

While 1

sleep (1)

If _IsPressed("20", $dll) Then

(count how many sec i pressed key)

(if i press f10 then press space the for x sec)

ExitLoop

EndIf

WEnd

DllClose($dll)

Thanks

Edited by Blindz
Link to comment
Share on other sites

#include <misc.au3>

$dll = DllOpen("user32.dll")

While 1

sleep (1)

If _IsPressed("20", $dll) Then

$start = TimerInit()

ExitLoop

EndIf

WEnd

While _IsPressed ( "20", $dll )

Sleep(1)

WEnd

TimerDiff($start)

DllClose($dll)

almost done but i dont know what do to after the 2nd loop Send("space") for TimerDiff($start)??

Link to comment
Share on other sites

can someone tell me why the sleep isnt good (where the function Shoot is)??

#include <misc.au3>

HotKeySet("{F3}","Shoot")

$dll = DllOpen("user32.dll")

While 1

sleep (1)

If _IsPressed("20", $dll) Then

$start = TimerInit()

ExitLoop

EndIf

WEnd

While _IsPressed ( "20", $dll )

Sleep(1)

WEnd

Func Shoot()

Send("{SPACE down}")

Sleep (TimerDiff($start) )

Send ("{space up}")

EndFunc

While 1

Sleep ( 1)

Wend

DllClose($dll)

Thanks

Edited by Blindz
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...