1 key to switch between 2 scripts Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omar bishr
Posts: 92
Joined: 23 Nov 2020, 23:05

1 key to switch between 2 scripts

Post by omar bishr » 28 Jan 2022, 16:18

i have this 2 scripts with 2 diffrent keys numpad7 and numpad8 i want to make only one key which is numpad7 to switch between the 2 scripts
with 1 key:

Code: Select all

$numpad7::
Send ^1
SoundBeep, 6500
Return
and

Code: Select all

$numpad8::
Send ^2
SoundBeep, 6500
Return

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: 1 key to switch between 2 scripts  Topic is solved

Post by amateur+ » 28 Jan 2022, 16:25

Code: Select all

$numpad7::
Ctrl1or2() {
	static toggle := 0
	Send, % "^" . ((toggle := !toggle) ? 1 : 2) 
	SoundBeep, 6500
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

Post Reply

Return to “Ask for Help (v1)”