Jump to content
Sign in to follow this  
muggl

Help with simple script

Recommended Posts

Hi guys, i m kinda new here and i got some trouble scripting some code.

i wanted to make a script, that owns this function:

While 1

MouseClick ("left")

WEnd

BUT !! i want to have endless mouseclicks only when i press down

e.g. F4. and when i release f4 i want the script to stop.

with my code that i pasted above, i got clicks everytime.

steps : is f4 pressed? if yes

mousclick left like hell

if not, do nothing.

so when i press f4 and hold it down. i want to have unlimited fast clicks.

hope i expressed myself clearly enough to receive some help.

take care.

Share this post


Link to post
Share on other sites

Try this:

HotKeySet("{Esc}", "MyExit")
HotKeySet("{F4}", "click")
While 1
WEnd

Exit

Func click()
    MouseClick("left")
EndFunc

Func MyExit()
    Exit
EndFunc

it will click as fast as holding down a key would repeat (and acts the same, it'll click once, wait a sec, then click like mad).

Edit: whoops, it's MouseClick("left") for your actual script, not Send("a") for my test. I fixed it. :lmao:

Edited by falconv

Share this post


Link to post
Share on other sites

Oh my god...thanks for your fast reply. i ll check that one!

thank you so much

<{POST_SNAPBACK}>

besides, is there a way to have like ... e.g. F3 pressed constantly instead of

the left mousebutton??

Share this post


Link to post
Share on other sites

sure, just replace MouseClick("left") with Send("{F3}")

or if you want both options, just copy the function "click", paste a copy of it, and rename it something else. Then replace Func click() with what you want the new function to be called, replace MouseClick("left") with what you want it to do, and add a copy of SetHotKey to the top with the new keypress followed by the new function:

HotKeySet("{Esc}", "MyExit")
HotKeySet("{F4}", "click")
HotKeySet("{F3}", "keypress")
While 1
WEnd

Exit

Func click()
    MouseClick("left")
EndFunc

Func keypress()
    Send("{Enter}")
EndFunc

Func MyExit()
    Exit
EndFunc
see?

Share this post


Link to post
Share on other sites

ok i swear to god..one last question. is there any possibility to get faster keystrokes? like right now there are remarkable stops between the automatic strokes...is there any way i cant fasten things up. and if so, where should that part of code be placed? thanks in advance ^^

Share this post


Link to post
Share on other sites

is there any possibility to get faster keystrokes ?

Put this at the top of your script

Opt("SendKeyDelay", 1)        ;1 milliseconds

ok i swear to god..one last question

Keep asking questions !!! its the bestway to learn. Edited by Nova

Share this post


Link to post
Share on other sites

Put this at the top of your script

Opt("SendKeyDelay", 1)        ;1 milliseconds

Keep asking questions !!! its the bestway to learn.

<{POST_SNAPBACK}>

i do not know what to say. i have never ever received so many and fast support replies. thank you .

Share this post


Link to post
Share on other sites

i do not know what to say. i have never ever received so many and fast support replies. thank you .

Welcome to www.autoitscript.com :lmao:

Those who have recieved so much, are only just dieing to give something back.

Edited by Nova

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...