How do I make Auto Hotkey do Alt+F4 when I press right mouse button and scroll wheel?

skillz21

My question is simple, I want a script in Auto Hotkey so that I can press Alt+F4 by pressing the right mouse button and scroll wheel. How do I do this?

Anaksunaman

I want a script in Auto Hotkey so that I can press Alt+F4 by pressing the right mouse button and scroll wheel. How do I do this?

If you haven't already done so, download and install AutoHotkey.

Looking at this basic overview on AutoHotkey hotkeys and this more complete key list, you can see:

  • Alt is represented by either ! or LAlt / RAlt (assuming you might want to trigger a specific Alt key).

  • F4 is represented by F4.

  • The right mouse button is represented by RButton.

  • The scroll wheel is represent by WheelDown, WheelUp or MButton. The first two assume the wheel is being "scrolled" and the last one assumes the scroll wheel is being "clicked".

  • AutoHotkey has a Send function to send keystrokes.

  • Hotkey combinations sometimes include & to bind two keys together.

  • Braces {} are necessary to Send keys with names that could also be typed (e.g. {Enter}, {Delete}, etc.).

Lastly, through observation, it can be determined that hotkey sequences and their respective script commands are typically separated by a double colon ::.

Armed with this information, you can now make a script. Since AutoHotkey script files are just simple text documents, your first step will be to open Windows Notepad. Next, putting together the information above, you might type something like:

MButton & RButton::Send !{F4}

You can then save this file with an .ahk extension (rather than .txt) to associate it with AutoHotkey. To start the saved script, simply double-click it (note that this assumes you installed AutoHotkey normally and it isn't already running).

Using the example script above, you could then (hypothetically) press the middle mouse button (scroll wheel), then the right mouse button and this would send Alt+F4.


Caveats

  • The first button you list is the prefix key (the button you press first to start a hotkey sequence). In this case, if we use the right mouse button first, this can interfere with normal right-click operations. Therefore, the middle mouse button should be listed/pressed first.

  • Regarding the right mouse button, while it is possible to use a tilde ~ in front of a key to send the original keypress (i.e. the normal function won't be blocked), this really doesn't seem to work correctly for your scenario.

  • Scroll wheel clicks can be fidgety on cheaper mice. If you have a mouse with extra buttons (such as a gaming mouse), you may wish to use one of those buttons instead.

  • Buttons sent with AutoHotkey are generally still sensitive to window focus. If you are using Alt+F4 to bring up the Windows shutdown menu, this may be something to consider.


本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How do I make this JS Turbolinks friendly?

来自分类Dev

How do I make an output for grep fail?

来自分类Dev

How do i change from mouse to touch instead?

来自分类Dev

How do I do the command Alt+M T D in LyX?

来自分类常见问题

In jQuery, how do I get the value of a radio button when they all have the same name?

来自分类Dev

How do i detect when the back button on an Android action layout is tapped?

来自分类Dev

How do I change the boot menu when I have no display?

来自分类Dev

how do i implement a "load more" button for meteor collection

来自分类Dev

How do I add a close button to a tab of the MahApps TabControl?

来自分类Dev

How do I highlight (select) text in Text widget with a button click?

来自分类Dev

Java: How do I make a loop which creates arrays?

来自分类Dev

In JIRA Agile, when I click a quickfilter I want other quickfilters to be unclicked, how can I do this?

来自分类Dev

How do I report error when setting a swift property?

来自分类Dev

How do i right align an icon set arrow under conditional formatting so that both number and arrow are on right side of cell neatly together?

来自分类Dev

How do I set up a custom navbar and a custom collapse? The right does not line up in mobile

来自分类Dev

How do I prevent Apache service from auto-starting on Linux?

来自分类Dev

How do I get Emacs to auto-complete tags and brackets for me?

来自分类Dev

How do I make this javascript function wait until I've scrolled x pixels down the page?

来自分类Dev

How to make a custom widget editable only when i click 'Edit' button?

来自分类常见问题

How do I resolve ClassNotFoundException?

来自分类Dev

How do I reload an Angular 6 component when a different component (that is not the parent/child) says to do so

来自分类Dev

usockets: How do I specify the external format when I open a socket

来自分类Dev

Do something when I clear an input

来自分类Dev

How do I inspect response headers in laravel 4 for unit testing?

来自分类Dev

alt + F4的自动热键脚本

来自分类Dev

How do I make a bitmap version of a WMF file that is loaded into a TImage.Picture and move that to a TSpeedButton.Glyph

来自分类Dev

How do I make vim automatically apply c++ syntax highlight on Arduino files (.ino/.pde)?

来自分类Dev

Spring + Hibernate: How do I efficiently chain two link tables and include resulting data in single entity? (user-role-right)

来自分类Dev

In F#, how do I tell if an object is an Async<_>, and how can I cast it to an Async<_>?

Related 相关文章

  1. 1

    How do I make this JS Turbolinks friendly?

  2. 2

    How do I make an output for grep fail?

  3. 3

    How do i change from mouse to touch instead?

  4. 4

    How do I do the command Alt+M T D in LyX?

  5. 5

    In jQuery, how do I get the value of a radio button when they all have the same name?

  6. 6

    How do i detect when the back button on an Android action layout is tapped?

  7. 7

    How do I change the boot menu when I have no display?

  8. 8

    how do i implement a "load more" button for meteor collection

  9. 9

    How do I add a close button to a tab of the MahApps TabControl?

  10. 10

    How do I highlight (select) text in Text widget with a button click?

  11. 11

    Java: How do I make a loop which creates arrays?

  12. 12

    In JIRA Agile, when I click a quickfilter I want other quickfilters to be unclicked, how can I do this?

  13. 13

    How do I report error when setting a swift property?

  14. 14

    How do i right align an icon set arrow under conditional formatting so that both number and arrow are on right side of cell neatly together?

  15. 15

    How do I set up a custom navbar and a custom collapse? The right does not line up in mobile

  16. 16

    How do I prevent Apache service from auto-starting on Linux?

  17. 17

    How do I get Emacs to auto-complete tags and brackets for me?

  18. 18

    How do I make this javascript function wait until I've scrolled x pixels down the page?

  19. 19

    How to make a custom widget editable only when i click 'Edit' button?

  20. 20

    How do I resolve ClassNotFoundException?

  21. 21

    How do I reload an Angular 6 component when a different component (that is not the parent/child) says to do so

  22. 22

    usockets: How do I specify the external format when I open a socket

  23. 23

    Do something when I clear an input

  24. 24

    How do I inspect response headers in laravel 4 for unit testing?

  25. 25

    alt + F4的自动热键脚本

  26. 26

    How do I make a bitmap version of a WMF file that is loaded into a TImage.Picture and move that to a TSpeedButton.Glyph

  27. 27

    How do I make vim automatically apply c++ syntax highlight on Arduino files (.ino/.pde)?

  28. 28

    Spring + Hibernate: How do I efficiently chain two link tables and include resulting data in single entity? (user-role-right)

  29. 29

    In F#, how do I tell if an object is an Async<_>, and how can I cast it to an Async<_>?

热门标签

归档