Sending a command when the shortcut exists

吃可爱长大的小学妹 提交于 2019-12-24 09:27:25

问题


I've got a global command like this

!i::Send {Up} (pressing alt+I will move the caret up)

There is an application that uses Alt+I as a shortcut for an action that I'd like to call while still retaining my own custom shortcut. I'd like to remap this app's action to Ctrl+I

Within a proper WinExists, I've tried ^i::Send !{i} but that just moves the caret up. I tried ^i::!i but that sends Ctrl+Alt+I and not Alt+I.

Any ideas? Thanks


回答1:


Gabe,

Try this...

SetTitleMatchMode, 2 ; Accept the title search string to be found anywhere in title

#ifWinnotActive yourappname ; use windowspy to find a unique title string
!i::Send {Up}
#ifWinActive

This will set !i to behave just like you want in ALL programs except for the one you want to keep the special behaviour.

Alternatively, you could add a $ to the triggers, so they will not call each other like this:

$!i::Send, {Up}
$^i::Send, !i



回答2:


After each command, you need to add the command return. So if you have the code:

!i::Send, ^i
return
^i::Send, !i
return

The code above inverts the functions of CTRL + i and ALT + i.



来源:https://stackoverflow.com/questions/11231031/sending-a-command-when-the-shortcut-exists

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!