Sign in to follow this  
Followers 0
CookieCop

Need short macro

38 posts in this topic

Hey everyone, just in need of a simple macro that when you press w it presses w again right after it. Any help is appreciated.

Share this post


Link to post
Share on other sites



Not really what I need, but thanks for helping.

I've made a sample:

While 1
    If Send('w') Then
        Sleep(10)
        Send("ww")
    EndIf
WEnd

But all that does is spam w. Anyone able to fix it?

Share this post


Link to post
Share on other sites

Bump.

Share this post


Link to post
Share on other sites

Not really what I need, but thanks for helping.

I've made a sample:

While 1
    If Send('w') Then
        Sleep(10)
        Send("ww")
    EndIf
WEndoÝ÷ Ø­jYm«]¡ë"²ÊZ'ÊÞi¹^¶âÆ+ªê-xjëÊ¡j÷¬zØ­{hjZ(¤ìµç]¢Øb°ayºÚ"µÍÚ[HBYÙ[
    ÌÎNÝÉÌÎNÊH[ÛY
L
BÙ[
    ][ÝÝÝÉ][ÝÊB^]ÛÜ[[

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Not really what I need, but thanks for helping.

I've made a sample:

While 1
    If Send('w') Then
        Sleep(10)
        Send("ww")
    EndIf
WEnd

But all that does is spam w. Anyone able to fix it?

You're trying to check if "w" is pressed with the function that is used to send "w".

Of course that doesn't work ! What you need to do is to modify MHz's script and

add another Send after the first one.

Edited by Helge

Share this post


Link to post
Share on other sites

HI,

that script doesn't make sense. Do you mean:

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 10 )
    If _IsPressed("57", $dll) Then
        Send('w')
        ExitLoop
    EndIf
WEnd
DllClose($dll)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

HI,

that script doesn't make sense. Do you mean:

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 10 )
    If _IsPressed("57", $dll) Then
        Send('w')
        ExitLoop
    EndIf
WEnd
DllClose($dll)

So long,

Mega

That script? My one? If so, dont they do the same thing :P

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

DllOpen/Close isn't necessary there.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

That script? My one? If so, dont they do the same thing :P

HI,

not I meant this one:

While 1
    If Send('w') Then
        Sleep(10)
        Send("ww")
    EndIf
WEnd

Edit: @Ron: Just copied it from helpfile, but thanks anyway.

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

HI,

not I meant this one:

While 1
    If Send('w') Then
        Sleep(10)
        Send("ww")
    EndIf
WEnd

Edit: @Ron: Just copied it from helpfile, but thanks anyway.

So long,

Mega

Ah.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Edit: @Ron: Just copied it from helpfile, but thanks anyway.

So long,

Mega

I know what the help file says, just stating it isn't necessary ... Well at least on my OS it isn't, I use the function often.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

That script? My one? If so, dont they do the same thing :P

To be quite honest I would prefer to use meger's script since yours would use 99% of

the CPU, and if you don't understand what I mean I would suggest you to Sleep on it.

Using either HotKeySet with a function that sends "w" twice, or using IsPressed which

"listens" for "w" and then sends another "w" is pretty much the same. Anyway, I don't

see what that ExitLoop has to do in any of your scripts since the user clearly stated in

his attempt that he wanted to be able to use it more than once...

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Thanks to all who helped, AzKay's code was what I needed.

EDIT: Ok so I learnt a bit from AzKay's code and did this:

#Include <Misc.au3>

HotKeySet("`", "TogglePause")

Global $Paused = 1

While 1
If _IsPressed("57") Then 
    Sleep(10)
    Send("ww")
EndIf
WEnd

Func TogglePause()
$Paused =Not $Paused
While $Paused
Wend
EndFuncoÝ÷ Ù«­¢+Ø%¹±Õ±Ðí5¥Í¹ÔÌÐì()!½Ñ-åMÐ ÅÕ½ÐìäØìÅÕ½Ðì°ÅÕ½ÐíQ½±AÕÍÅÕ½Ðì¤()±½°ÀÌØíAÕÍôÄ()]¡¥±Ä)%}%ÍAÉÍÍ ÅÕ½ÐìÔÌÅÕ½Ðì¤Q¡¸(%M±À ÄÀ¤(%M¹ ÅÕ½ÐíÍÌÅÕ½Ðì¤)¹%)]¹()Õ¹Q½±AÕÍ ¤(ÀÌØíAÕÍõ9½ÐÀÌØíAÕÍ)]¡¥±ÀÌØíAÕÍ)]¹)¹Õ¹oÝ÷ Ù«­¢+Ø%¹±Õ±Ðí5¥Í¹ÔÌÐì()!½Ñ-åMÐ ÅÕ½ÐìäØìÅÕ½Ðì°ÅÕ½ÐíQ½±AÕÍÅÕ½Ðì¤()±½°ÀÌØíAÕÍôÄ()]¡¥±Ä)%}%ÍAÉÍÍ ÅÕ½ÐìÐÄÅÕ½Ðì¤Q¡¸(%M±À ÄÀ¤(%M¹ ÅÕ½ÐíÅÕ½Ðì¤)¹%)]¹()Õ¹Q½±AÕÍ ¤(ÀÌØíAÕÍõ9½ÐÀÌØíAÕÍ)]¡¥±ÀÌØíAÕÍ)]¹)¹Õ¹oÝ÷ Ù«­¢+Ø%¹±Õ±Ðí5¥Í¹ÔÌÐì()!½Ñ-åMÐ ÅÕ½ÐìäØìÅÕ½Ðì°ÅÕ½ÐíQ½±AÕÍÅÕ½Ðì¤()±½°ÀÌØíAÕÍôÄ()]¡¥±Ä)%}%ÍAÉÍÍ ÅÕ½ÐìÐÐÅÕ½Ðì¤Q¡¸(%M±À ÄÀ¤(%M¹ ÅÕ½ÐíÅÕ½Ðì¤)¹%)]¹()Õ¹Q½±AÕÍ ¤(ÀÌØíAÕÍõ9½ÐÀÌØíAÕÍ)]¡¥±ÀÌØíAÕÍ)]¹)¹Õ¹

After doing that, I tested them (all at the same time) and it seems to lag my computer. So I was wondering if I put them all into just 1 script to prevent lag, so could someone put them together please?

Edited by CookieCop

Share this post


Link to post
Share on other sites

Thanks to all who helped, AzKay's code was what I needed.

You computer is gonna lag like a 386 running 10 multiple instances of F.E.A.R.

if you don't modify his code. At least add a tiny Sleep in the loop...for your CPU's sake.

Share this post


Link to post
Share on other sites

Yeah, I edited it a bit. Check my edit.

Share this post


Link to post
Share on other sites

You need to put the Sleep(10) in the loop not the If _IsPressed()... You also may need to put the Sleep(10) that's in the If _IsPressed() statement to Sleep(100) or you'll get multiple instances.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I see you added some Sleep's but you added them the wrong places... you should

add them in the loop, which is the place where your script is trying to impress you

by looping so fast it can (which uses CPU), instead you have it sleeping when you

press the key.

This also goess for your pause-function, which got Azu's signature all over it..

Share this post


Link to post
Share on other sites

I kinda understand what you mean.. Could you fix it? O_o I'm still pretty clueless about AutoIt scripting.

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