CookieCop Posted September 2, 2006 Posted September 2, 2006 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.
MHz Posted September 2, 2006 Posted September 2, 2006 Disable the hotkey before using it within the function. HotKeySet('w', '_HotKey_w') While 1 Sleep(1000) WEnd Func _HotKey_w() HotKeySet('w');disable Send('w');use HotKeySet('w', '_HotKey_w');enable again EndFunc
CookieCop Posted September 2, 2006 Author Posted September 2, 2006 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?
PantZ4 Posted September 2, 2006 Posted September 2, 2006 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^]ÛÜ[YÑ[
Helge Posted September 2, 2006 Posted September 2, 2006 (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 September 2, 2006 by Helge
AzKay Posted September 2, 2006 Posted September 2, 2006 #include <Misc.au3> While 1 If _IsPressed("57") Then Send("w") WEnd # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Xenobiologist Posted September 2, 2006 Posted September 2, 2006 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
AzKay Posted September 2, 2006 Posted September 2, 2006 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, MegaThat script? My one? If so, dont they do the same thing # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Moderators SmOke_N Posted September 2, 2006 Moderators Posted September 2, 2006 DllOpen/Close isn't necessary there. 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.
Xenobiologist Posted September 2, 2006 Posted September 2, 2006 (edited) That script? My one? If so, dont they do the same thing 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 September 2, 2006 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
AzKay Posted September 2, 2006 Posted September 2, 2006 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, MegaAh. # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Moderators SmOke_N Posted September 2, 2006 Moderators Posted September 2, 2006 Edit: @Ron: Just copied it from helpfile, but thanks anyway.So long,MegaI 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. 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.
Helge Posted September 2, 2006 Posted September 2, 2006 That script? My one? If so, dont they do the same thing To be quite honest I would prefer to use meger's script since yours would use 99% ofthe 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'tsee what that ExitLoop has to do in any of your scripts since the user clearly stated inhis attempt that he wanted to be able to use it more than once...
CookieCop Posted September 2, 2006 Author Posted September 2, 2006 (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 September 2, 2006 by CookieCop
Helge Posted September 2, 2006 Posted September 2, 2006 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.
CookieCop Posted September 2, 2006 Author Posted September 2, 2006 Yeah, I edited it a bit. Check my edit.
Moderators SmOke_N Posted September 2, 2006 Moderators Posted September 2, 2006 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. 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.
Helge Posted September 2, 2006 Posted September 2, 2006 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..
CookieCop Posted September 2, 2006 Author Posted September 2, 2006 I kinda understand what you mean.. Could you fix it? O_o I'm still pretty clueless about AutoIt scripting.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now