One key 2 functions. Help please

Get help with using AutoHotkey and its commands and hotkeys
Riv3r888
Posts: 4
Joined: 15 Feb 2020, 19:52

One key 2 functions. Help please

10 Jun 2020, 18:13

I am trying to run two macros simultaneously. Can someone make these 2 macros work together off the same key simultaneously. I would like to hit Capslock once and it overlaps these 2 macros. I can run 2 processes or just 1, just as long as i can get it to work. Thank you in advance. If i put both functions into the same script i get the error "duplicate hotkey" and if i try to run 2 macros separately I only get input from one of them.

Code: Select all

capslock::
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
sleep, 50
send, d
return

here is the 2nd one.

Code: Select all

capslock::
sleep, 1000
send, s
sleep, 100
Click, right
sleep, 500
Click, right
sleep, 500
Click, right
sleep, 500
Click, right
sleep, 500
Click, right
sleep, 500
return

Riv3r888
Posts: 4
Joined: 15 Feb 2020, 19:52

Re: One key 2 functions. Help please

10 Jun 2020, 19:05

Can someone please help. I know this is easy fix for someone here.
User avatar
Scr1pter
Posts: 1193
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: One key 2 functions. Help please

10 Jun 2020, 19:48

One idea could be to put the 1st script under Capslock::
and the second one under Capslock up::

Code: Select all

Capslock::
Loop, 20 ; I didn't count them...
{
  Send d
  Sleep, 50
}
return

Capslock up::
Sleep, 1000
Send s
Sleep, 100
Loop, 5
{
  Click, right
  Sleep, 500
}
return
There is perhaps a better way, but I can't check it right now.
Good luck.

And just as a hint:
Avoid copying and pasting code lines, it has only disadvantages.

Edit:
I think it will not work because the Loop has to be finished before Capslock up:: can start.
Maybe you will really need MaxThreadsPerHotkey, 2

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G15 FE - Mice: Logitech G9 FE, G502 FE, G602, Jelly Comb Touchpad - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.32.00
Riv3r888
Posts: 4
Joined: 15 Feb 2020, 19:52

Re: One key 2 functions. Help please

11 Jun 2020, 14:32

This didnt work for me. it doesnt overlap as i hoped. it runs part of 1 then part of the other then finishes the 1st one. I need them to run simulteonusly.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], jasonsparc, Odlanir, rhaos, Sabestian Caine, Sefrautic and 38 guests