Jump to content
Sign in to follow this  
CookieCop

In need of a simple macro

Recommended Posts

CookieCop

Hello, I'm new to AutoIt and the forums.

Anyway, I need a macro so that when left-click it waits 0.2 seconds then presses R.

Judging by what I know of AutoIt so far (Very little) I think it goes something like:

If MouseClick("Left")
           Sleep(200)
           Send("R")

Sorry if that doesn't help, but as I already said, I know very little about AutoIt coding.

Could someone make this please?

Thanks in advance,

CookieCop.

Share this post


Link to post
Share on other sites
CookieCop

Thanks for the quick reply.

It works, but there's a problem. I forgot to mention that I want this to run continuously.. Sorry about that.

The script you just posted only runs once, could you improve it please? =)

EDIT: Ok, so I fixed it up a bit

While 1
    If MouseClick("Left") Then
        Send("R")
    Endif
WEnd

But, there is still 1 problem. It Left-Clicks automatically, which I don't want to happen. I'd like it so that WHEN I Left-Click, it presses R. Not, it continuously Left-Clicks and presses R.

Someone please fix?

Edited by CookieCop

Share this post


Link to post
Share on other sites
SmOke_N

Misc.au3 + _IsPressed('01') + Send('R')

Edit:

So it would look like:

#include <Misc.au3>
While 1
    If _IsPressed('01') Then
        Sleep(200)
        Send("R")
    EndIf
    Sleep(10)
WEnd
Edited by SmOke_N

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.

Share this post


Link to post
Share on other sites
CookieCop

SmOke_N and MHz thankyou so much. It's working now. :P

Edited by CookieCop

Share this post


Link to post
Share on other sites
MHz

Sorry, MouseClick seems to always return 1, so Smoke's code is the working solution.

Share this post


Link to post
Share on other sites
CookieCop

Alright, so

#include <Misc.au3>
While 1
    If _IsPressed('01') Then
        Sleep(80)
        Send("r")
    EndIf
    Sleep(10)
WEnd
is working perfectly BUT, I'd like a little adjustment if possible. (Also, I changed the Sleep Delay to 80)

I want it so that if the number 2 or 3 is pressed during that 80 Sleep Delay it won't press "r" afterwards.

Could someone please make this adjustment?

Thanks in advance, CookieCop.

Share this post


Link to post
Share on other sites
Paulie

Alright, so

#include <Misc.au3>
While 1
    If _IsPressed('01') Then
        Sleep(80)
        Send("r")
    EndIf
    Sleep(10)
WEndoÝ÷ Ú+0¢¹"
^­÷¶Q27õÙbæ¥Ûey§cºËfz{b~,²&åx  l !jxvØ^JW¤7¥k+hóB0j{b¶Ê-«b~Ø^éz½¨¯x¬¦·¬±ç]º¸§ØZ·Íç©
éZÊ+p¢}ý¶Þ²Ê®¢ÚêºZ~׫ÁªÝ°*.Û(ê'z^jǦjG­+v;¬¶g§µ8ZK"§ojw
$ਧú®¢×ºÚ"µÍÒ[ÛYH ÓZØË]LÉÝÂÝÙ^TÙ]
    ][ÝÌ][ÝË    ][ÝÕÙÙÛT]ÙI][ÝÊBÝÙ^TÙ]
    ][ÝÌÉ][ÝË  ][ÝÕÙÙÛT]ÙI][ÝÊBÛØ[   ÌÍÔ]ÙYHBÚ[HBYÒÔÜÙY
    ÌÎNÌIÌÎNÊH[ÛY

BÙ[
    ][ÝÜ][ÝÊB[YÛY
L
BÛÛ
    ][ÝÔØÜÈ[[É][ÝË
BÑ[[ÈÙÙÛT]ÙJ
BÌÍÔ]ÙYSÝ  ÌÍÔ]ÙYÚ[H  ÌÍÔ]ÙYÛY
Ì
BÛÛ
    ][ÝÔØÜÈ]ÙY    ][ÝË
BÙ[[[Â

Works for me just push 2 or 3 again and it will send again

Edited by Paulie

Share this post


Link to post
Share on other sites
CookieCop

That's great, although, could you make it so that you don't have to press 2 or 3 again to resume running the script? But I like how that hotkey pause works, could you reassign that to "`" please? (The key left of "1")

Edited by CookieCop

Share this post


Link to post
Share on other sites
SmOke_N

That's great, although, could you make it so that you don't have to press 2 or 3 again to resume running the script? But I like how that hotkey pause works, could you reassign that to "`" please? (The key left of "1")

Did you make your donation :P ?

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.

Share this post


Link to post
Share on other sites
CookieCop

Donation? :S

Share this post


Link to post
Share on other sites
SmOke_N

Donation? :S

Yes, you have people making scripts for you, and you've put no work other than what you "want" it to do... I figure you could either A.) Go to RentACoder.com or B.) Make an AutoIt donation to continue to get help, and post the transaction ID to verify :P

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.

Share this post


Link to post
Share on other sites
CookieCop

o_O I never knew I had to pay for scripts. Heh, does giving drafts or ideas for a script count as a donation?

Share this post


Link to post
Share on other sites
SmOke_N

o_O I never knew I had to pay for scripts. Heh, does giving drafts or ideas for a script count as a donation?

No, my 7 year old can do that :P

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.

Share this post


Link to post
Share on other sites
CookieCop

Rofl. Alright then, guess I'll have to browse around for some tutorial and learn by myself. =/

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  

×