Basically I would need help with a script here, since im kinda newbie.
I would need a script that does the following
-If i press "3" it should press 3 times key "3" with maybe a delay inbetween that I can change around. After it it should press 1. So basically I press 3 -> it does 3 - 3 -3 - 1
-Same with key 4 and key 5 basically. Not sure if I can do it in 1 script or I need 3 scripts for it
Thanks alot <3
Script to press a key multiple times if i press that key Topic is solved
Re: Script to press a key multiple times if i press that key
Can you please explain what makes you think you can only have 1 hotkey per file? this is a mildly frequent 'issue'. Perhaps you could shed some light on it.Not sure if I can do it in 1 script or I need 3 scripts for it
From the tutorial section 2.3 https://autohotkey.com/docs/Tutorial.htm#s23
Multiple hotkeys/hotstrings per file
This, for some reason crosses some people's minds. So I'll set it clear: AutoHotkey has the ability to have as many hotkeys and hotstrings in 1 file as you want. Whether it's 1, or 3253 (or more).The above code is perfectly acceptable. Multiple hotkeys, multiple hotstrings. All in one big happy script file.Code: Select all
#i:: run, http://www.google.com/ Return ^p:: run, notepad.exe Return ~j:: send, ack Return :*:acheiv::achiev ::achievment::achievement ::acquaintence::acquaintance :*:adquir::acquir ::aquisition::acquisition :*:agravat::aggravat :*:allign::align ::ameria::America
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
*poke*
Is it December 21, 2012 yet?
Re: Script to press a key multiple times if i press that key
Hey, thanks for your reply
as I said I dont really have much knowledge about creating a script and so I didnt know if you could put them all into one.
Thanks for your reply tho.
Someone got an idea how I could make the script do what I described above?
as I said I dont really have much knowledge about creating a script and so I didnt know if you could put them all into one.
Thanks for your reply tho.
Someone got an idea how I could make the script do what I described above?
-
- Posts: 1259
- Joined: 16 Apr 2015, 09:41
Re: Script to press a key multiple times if i press that key
Scripts like the one you are requesting are extremely simple. Reading the Tutorial should tell you everything you need to know to create this type of script yourself. However, here's your script just in case the tutorial is too much for you...ArdisX wrote:Hey, thanks for your reply
as I said I dont really have much knowledge about creating a script and so I didnt know if you could put them all into one.
Thanks for your reply tho.
Someone got an idea how I could make the script do what I described above?
Code: Select all
3::
Send 3
Sleep 500 ; This is a 0.5 second delay. I chose that length just because I could.
Send 3
Sleep 250 ; This is a 0.25 second delay. I chose that length just because I could.
Send 3
Sleep 400 ; This is a 0.4 second delay. I chose that length just because I could.
Send 1
Return
4::
Send 4
Sleep 500 ; This is a 0.5 second delay. I chose that length just because I could.
Send 4
Sleep 250 ; This is a 0.25 second delay. I chose that length just because I could.
Send 4
Sleep 400 ; This is a 0.4 second delay. I chose that length just because I could.
Send 1
Return
5:: ; I did this one without delays in it, just so you could see the difference.
Send 5551
Return
; And just for the fun if it, here's another way to do it without delays...
6::Send 6661
Re: Script to press a key multiple times if i press that key
Thanks for your help.
Although if i try to use your script and press for example "3", I only get an output of 1 and that repeatedly. Basically what I would need is that it only does it once whenever I press 3.
So if I press 3 it does 3 3 3 1 and then does nothing anymore till I press 3 again. If someone would help me I would be grateful
Although if i try to use your script and press for example "3", I only get an output of 1 and that repeatedly. Basically what I would need is that it only does it once whenever I press 3.
So if I press 3 it does 3 3 3 1 and then does nothing anymore till I press 3 again. If someone would help me I would be grateful
-
- Posts: 1259
- Joined: 16 Apr 2015, 09:41
Re: Script to press a key multiple times if i press that key
ArdisX wrote:Thanks for your help.
Although if i try to use your script and press for example "3", I only get an output of 1 and that repeatedly. Basically what I would need is that it only does it once whenever I press 3.
So if I press 3 it does 3 3 3 1 and then does nothing anymore till I press 3 again. If someone would help me I would be grateful
That is exactly what the script I provided does. I tested the script before I posted it, and it works correctly. If you are seeing other behavior, then I can only assume you either have some other script interfering, or made an error when copying the code I provided.
Re: Script to press a key multiple times if i press that key Topic is solved
Try putting a $ modifier on all the hotkeys That is, make it $3::, $4::, $5::, and $6::. Otherwise, you can use the #UseHook directive.
The idea is that your hotkeys with the code Shadow posted are recursing. The Send 3 activates the 3:: hotkey again and again.
Edit: @Shadow, I can confirm that running your code as is gets me the same results as the OP. A string of "1"s appear when I hit "3".
The idea is that your hotkeys with the code Shadow posted are recursing. The Send 3 activates the 3:: hotkey again and again.
Edit: @Shadow, I can confirm that running your code as is gets me the same results as the OP. A string of "1"s appear when I hit "3".
-
- Posts: 1259
- Joined: 16 Apr 2015, 09:41
Re: Script to press a key multiple times if i press that key
Now I am really confused. The script worked perfectly before I posted it (and was the only code I had running). However, I just tried it again after reading Exaskryz's post, and now I too am getting the repeating "1"s. Adding either the $ modifier, or the #UseHook directive fixes it.
Re: Script to press a key multiple times if i press that key
Maybe my script from this thread https://autohotkey.com/boards/viewtopic ... 19&t=13162 can help you
just comment out the other hotkeys and put this in
3=3,50,u|3,50,u|3,50,u|1,100,u
.
just comment out the other hotkeys and put this in
3=3,50,u|3,50,u|3,50,u|1,100,u
.
Who is online
Users browsing this forum: prototype_zero and 74 guests