Two non-functional key combination

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Two non-functional key combination

Post by Joey5 » 19 May 2023, 05:42

Hi,
New to AHK and hope to get some help here.

I have following scripts which work fine.

3::
Send, +1

4::
Send, !L

Simultaneous pressing 3 and 4:
~3 & 4::
Send, #5

Is it possible to write a script which retains above function but also allows me to first press the 3 key followed by the 4 key (in sequence and not simultaneously) to send a different command. Just the usual delay it takes to press one key after another.
Can't figure out sleep or keywait features.

Specifically looking for the following without affecting aforementioned scripts.
" 3 followed by 4"::
Send, #1

Thank you in advance.
Last edited by gregster on 19 May 2023, 05:59, edited 1 time in total.
Reason: Moved topic to AHK v1 help.

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: Two non-functional key combination

Post by mikeyww » 19 May 2023, 06:08

Welcome to this AutoHotkey forum!

Could you post your actual working script as an intact, coded section here on the forum? Use the code tags on the forum. Can we assume that your intent is that the hotkey subroutines "fall through" (continue) to the next subroutine, since you have omitted Return commands?

With Return commands:

Code: Select all

#Requires AutoHotkey v1.1.33

3::
Send a
Return

4::
If (A_PriorKey = 3 && A_TimeSincePriorHotkey < 500)
 Send x
Send b
Return

~3 & 4::
Send c
Return
Test in Notepad.

If you do not need to send an uppercase letter with Alt, then don't; use lower case.

If you are new to AutoHotkey, then I recommend using the current version (v2) instead of this older one.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 19 May 2023, 07:01

Thank you so much your prompt response. I am at work. Will try to figure out how to send the script.
🙏

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 20 May 2023, 06:36

Hi,
Thank you once again.

1) I'll like to install v2 but was hoping to find official SHA256 hash for it so I can feel confident that the file has not been altered. I have 110% trust in AHK but it will be nice to cross check the download.

2) I tried your script.
a) 3 send a and 4 sends b as intended. Perfect.
b) However, when I type 3 and then immediately 4 (as if I am transcribing number 34), it sends axb and not c. Can you suggest a solution?
c) If I simultaneously press 3 and 4 keys, it sometimes sends ac and sometimes ba. I am sure it is based on which of the key is pressed fractionally before the other key even though I am trying to press both simultaneously. Is it possible to get the same output every time? Regardless of which of the two key gets pressed quicker?

3) I am hoping to keep my input choices from 0 to 9. I am hoping to have separate output for i) pressing 3 and 4 simultaneously and ii) pressing them one after another as in typing the number 34.

Sorry for being long winded and I appreciate all the help.

User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: Two non-functional key combination

Post by boiler » 20 May 2023, 07:24

See this page for sha256 files.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 20 May 2023, 07:40

Thank you, Boiler.
Why are my files not matching.
Based on the link you provided SHA256 for 2.0.2 should be the following.
8F28C38A0B2AF6AC96C4A7E1A2C0F296B2410F845D9ACA8487843A1EDAC4271D

Instead, I am getting the following when I obtain SHA256 from the downloaded file.
9c8b1aecaf1bdded80bec98ec5ab5b9b9754cbce9439dd9eacc7d1774d1438f8

Thank you.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 20 May 2023, 07:55

I have the following separate scripts. When I press 3 or 4, they work and send Windows+3 and Windows+4 commands respectively as it intended.

Code: Select all

3::
Send, #3
Return

Code: Select all

4::
Send, #4
Return
However, if I simultaneous press 3&4, it sometimes acts correctly and sends Windows+5 command. But often it first executes the 3 key and sends Windows+3 (aforementioned 3:: command) and then sends Windows+5 command. If the 3:: is not activated, it will often send 3 and then Windows+5. What do I do for the following script to only execute Windows+5? Thanks you.

Code: Select all

~3 & 4::
Send, #5
Return
As one would expect changing the last script to ~4 & 3 often first fires 4 before Windows+5.

Thank you much.

User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: Two non-functional key combination

Post by boiler » 20 May 2023, 08:36

Joey5 wrote:
20 May 2023, 07:40
Based on the link you provided SHA256 for 2.0.2 should be the following.
8F28C38A0B2AF6AC96C4A7E1A2C0F296B2410F845D9ACA8487843A1EDAC4271D

Instead, I am getting the following when I obtain SHA256 from the downloaded file.
9c8b1aecaf1bdded80bec98ec5ab5b9b9754cbce9439dd9eacc7d1774d1438f8
The 8F28... hash is for the .zip file. The one you are getting (9C8B...) is for the unzipped .exe and is also on there.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 20 May 2023, 11:32

Sorry, Boiler. I should have paid more attention. Thanks.

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: Two non-functional key combination

Post by mikeyww » 20 May 2023, 12:58

Tilde lets the hotkey itself be sent. To block that key from being sent, remove the tilde.

The first (prefix) key must be pressed first, but you can add a second custom combination that reverses the order of the keys.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 20 May 2023, 19:22

Hi, Mikeyww,
I tried without tilde. Tried with 4&3 and 3&4 sending the same command. Still it often types 3 or 4 before executing. Been trying keywait but have not been able to. Any help will be greatly appreciated.

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: Two non-functional key combination

Post by mikeyww » 21 May 2023, 07:17

I'm finding your description unclear at this point. You've mentioned a few different scenarios but not provided a single listing of what every key and key combination or sequence should do. Thus, I took a guess. Try this one in Notepad. You have the tools here to rearrange any of this to get what you want, I think.

Code: Select all

#Requires AutoHotkey v1.1.33

4::Send b

3::
Send a
KeyWait 4, DT.5
If !ErrorLevel
 Send x
Return

3 & 4::
4 & 3::Send c

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 21 May 2023, 09:26

Mikeyww, thank you so much for following up. I tried your script but it did not work for me.

Based on my research, I tried the following. But instead of getting "x" as an output, I get "3x". Cant figure out how to correct my script so sending 4 and then 3 in quick strokes gives me x and not 3x. Thank you in advance.

Code: Select all

$4::
	KeyWait, 3, DT0.5 
	if ErrorLevel 
		Send, b 
	else 		
	Send, x
	
return

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 21 May 2023, 09:40

Mikeyww,
My sincere apologies. The following script of yours DID work. I had made a mistake. My bad.
It acts as I wanted by sending a with 3, b with 4 and c with simultaneous 3 & 4.

Is it possible to send d by pressing 3, waiting 1 second and then pressing 4. Thank you in advance.

Code: Select all

4::Send b

3::
Send a
KeyWait 4, DT.5
If !ErrorLevel
 Send x
Return

3 & 4::
4 & 3::send c

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: Two non-functional key combination

Post by mikeyww » 21 May 2023, 10:37

I leave the additions and new goals to you! Best wishes.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 21 May 2023, 11:09

Thank you.
I need to figure out on my own or with someone's help to modify the following so I can get x instead of 3x.

Code: Select all

$4::
	KeyWait, 3, DT0.5 
	if ErrorLevel 
		Send, b 
	else 		
	Send, x
	
return

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 25 May 2023, 05:44

I love the following script and hope to add several more by using two adjacent keys as combination to execute different actions. However, it creates two new problems which I have not been able to solve. Help will be greatly appreciated. Thank you.
Problem 1: Can no longer type d and r keys as capital D and R. Only lower-case works.
Problem 2. Other independent short cuts containing these keys stopped working. e.g., Ctrl+Shft+d has stopped working.

Is there a solution? Please help.
Thank you.

Code: Select all

r::Send r

d::
Send d
KeyWait r, DT.2
If !ErrorLevel
 Send x
Return

r & d::
d & r::send, #4

User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: Two non-functional key combination

Post by mikeyww » 25 May 2023, 06:09

Code: Select all

#Requires AutoHotkey v1.1.33

r::r
+d::Send {Blind}d
^+d::Send 9999
r & d::
d & r::Send #4

$d::
Send d
KeyWait r, DT.2
If !ErrorLevel
 Send x
Return

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 25 May 2023, 06:27

Mikeyww, you rock, sir. Can’t wait to try it. Thank you much.

Joey5
Posts: 70
Joined: 19 May 2023, 05:25

Re: Two non-functional key combination

Post by Joey5 » 25 May 2023, 06:42

Just tried it. It worked like a charm. Curious if while d & r (and r & d) script is active, if some other script with s & d (and d & s) will work. Cant wait to try it this evening. Thank you, sir.

Post Reply

Return to “Ask for Help (v1)”