Jump to content

Keydown and loop?


 Share

Recommended Posts

Hi there, i've been use AutoIT for about 1 year ago, but since then i haven't done anything in AutoIT, but now i would want to start learn again.. But i forgot alot >.>

I see the AutoIT help file, but i haven't find these..

Example, i write something here for example, and then i want it to hold down the left arrow like 5 secounds.

I tried do this

Send("{LEFT DOWN}")

Sleep(5000)

Send("{LEFT UP}")

But it's not working! I was google fast and saw a thread from this forum, about a guy who wanted made SHIFT up, so they wrote {SHIFTDOWN} instead, but i tried that with the LEFT to write {LEFTDOWN} but it didn't work too :S

How to do!?

And the other question is how to make a loop..

Example this, i dont know how the start on the top was going to look like :S

[sTART]

If 1=1 then

Send("{LEFT DOWN}")

Sleep(1000)

Send("{LEFT UP}")

Sleep(1000)

GoTo START

Link to comment
Share on other sites

OMG -.-

In example, in the AutoIT help file it says

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

But it doesn't even work, i tried press in a Sleep(5000) between the down and up codes..

But not worked ._.

Link to comment
Share on other sites

Hi Effect...

1. I don't know either.. There is another similar topic: http://www.autoitscript.com/forum/index.php?showtopic=103087&st=0&p=731386&#entry731386 , which we have discussed yesterday... ends with no solution.

2. That was an old syntax.. the "goto" command. According to the Help File:

Just to get you started, the most basic use of Goto in version 2.64 was an infinite loop like:

:mylabel

...do something...

...and something else...

goto, mylabel

A simple v3 version of that is a While loop that is always "true".

While 1 = 1

...do something...

...do something else...

Wend

Hi ;)

Link to comment
Share on other sites

OMG -.-

In example, in the AutoIT help file it says

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

But it doesn't even work, i tried press in a Sleep(5000) between the down and up codes..

But not worked ._.

Hi,

I couldn't run Send ("{a up}") as well. It's just given one a.

So you might use a loop, e.g.:

shellexecute ("notepad.exe")
WinWaitActive ("Untitled")
$i = 0
While $i < 50
    Send ("{a}") 
    $i += 1
Wend

;-))

Stefan

Link to comment
Share on other sites

Gaah would be better to use a hold down key :S Why not working? Before it was work :S

OMG what have they done? nothing works nowadays, before it was 100000 times better

Sleep(1000)

GoTo Test()

Func Test()

$x = 0

While $x < 50

Send ("{X}")

$x += 1

Wend

EndFunc

Look that not working, how come?

I also need to have functions, its better, but why not working? i tried without the GoTo func first but it didnt jump into the function, so how to get in there?

Edited by Effect
Link to comment
Share on other sites

OMG -.-

In example, in the AutoIT help file it says

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

But it doesn't even work, i tried press in a Sleep(5000) between the down and up codes..

But not worked ._.

The AutoIt help file states:

To hold a key down (generally only useful for games)

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

If it is not "working" in a game then maybe a tool like game guard is blocking automated key strokes.

"a down" is not the same as a human pressing the "a" key on the keyboard until the "key repeat" function kicks in

I doubt that your god cares what the AutoIt help file says... such an over used phrase.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

The AutoIt help file states:

To hold a key down (generally only useful for games)

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

If it is not "working" in a game then maybe a tool like game guard is blocking automated key strokes.

"a down" is not the same as a human pressing the "a" key on the keyboard until the "key repeat" function kicks in

I doubt that your god cares what the AutoIt help file says... such an over used phrase.

Well, i was tried it in a notepad and it didn't work to hold or repeat the key that way, so

Send("{a down}")

sleep(5000)

Send("{a up}")

works like just typing Send("a")

and yes, in the game it would work, but not even work in notepad so.

Edited by Effect
Link to comment
Share on other sites

I know Send("{a down}") won't works as I've tried it before, despite what help file says.. Send("{SHIFTDOWN}") works... Send("{a 10}") also works..

It seems like Send("{a down}") behaves just like Send("a")

Hi ;)

Link to comment
Share on other sites

... despite what help file says.. Send("{SHIFTDOWN}") works... Send("{a 10}") also works..

Shift is a modifier key and it "works" with "down" differently than "a down". Both work as they work as designed. You just gotta get it out of your head that "a down" is going to do the same thing that would happen if a human held the a key down. They are two different things - mainly for gaming.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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...