a key to active keyboard shortcut 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

a key to active keyboard shortcut

Post by omar bishr » 27 Jan 2022, 05:36

i maked this script work for any keyboard shortcut so when i make keyboard shortcut from the program options
like: shift+ctrl+M to change font size in WORD for ex
now i will use autohotkey script to make this keyboard shortcut simple by:

Code: Select all

#If GetKeyState("ScrollLock", "T") && WinActive("ahk_exe WINWORD.exe")
$m::
SoundBeep, 1500, 20
Send m{ctrl Down}{shift Down}
Sleep, 200
SoundBeep, 1000, 20
Send m{ctrl Up}{shift up}
Return
if the scroll lock on i can just press m to active my keyboard shortcut and when scroll lock is off i can use my key normal
here my script problem when i press M if scroll lock on shortcut work nicely but with that its type "m" in my page of the word i want when i press "m" if the scroll lock on
to only active my keyboard shortcut witch is shift+ctrl+M without type "m"
so what i want if i press M when scroll lock on just for active "this shift+ctrl+M" and disable M form type in the word page
and when scroll lock off every thing back normal

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

Re: a key to active keyboard shortcut

Post by mikeyww » 27 Jan 2022, 06:35

The Send command sends whatever key sequence occurs on that line. You can replicate it manually yourself, key by key, to see what the command does. If you do not want to send the M, then you can remove it from the Send command (line 4).

omar bishr
Posts: 92
Joined: 23 Nov 2020, 23:05

Re: a key to active keyboard shortcut

Post by omar bishr » 27 Jan 2022, 07:39

i get it

Code: Select all

$m::
SoundBeep, 1500, 20
m{ctrl Down}{shift Down}
Sleep, 200
SoundBeep, 1000, 20
m{ctrl Up}{shift up}
Return
can you add this pls:
when i press "m" when scroll lock on active the shortcut + scroll lock off

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

Re: a key to active keyboard shortcut

Post by mikeyww » 27 Jan 2022, 08:39

Code: Select all

#If GetKeyState("ScrollLock", "T") && WinActive("ahk_exe WINWORD.exe")
NumpadIns::
Send ^+m
SoundBeep, 1500
SetScrollLockState, Off
Return
#If

omar bishr
Posts: 92
Joined: 23 Nov 2020, 23:05

Re: a key to active keyboard shortcut  Topic is solved

Post by omar bishr » 27 Jan 2022, 09:20

thx man this what i mean :bravo:

Code: Select all

#If GetKeyState("ScrollLock", "T") && WinActive("ahk_exe WINWORD.exe")
$m::
Send ^+m
SoundBeep, 1500
SetScrollLockState, Off
Return
#If

Post Reply

Return to “Ask for Help (v1)”