atwiki-logo
  • 新規作成
    • 新規ページ作成
    • 新規ページ作成(その他)
      • このページをコピーして新規ページ作成
      • このウィキ内の別ページをコピーして新規ページ作成
      • このページの子ページを作成
    • 新規ウィキ作成
  • 編集
    • ページ編集
    • ページ編集(簡易版)
    • ページ名変更
    • メニュー非表示でページ編集
    • ページの閲覧/編集権限変更
    • ページの編集モード変更
    • このページにファイルをアップロード
    • メニューを編集
    • 右メニューを編集
  • バージョン管理
    • 最新版変更点(差分)
    • 編集履歴(バックアップ)
    • アップロードファイル履歴
    • ページ操作履歴
  • ページ一覧
    • ページ一覧
    • このウィキのタグ一覧
    • このウィキのタグ(更新順)
    • このページの全コメント一覧
    • このウィキの全コメント一覧
    • おまかせページ移動
  • RSS
    • このウィキの更新情報RSS
    • このウィキ新着ページRSS
  • ヘルプ
    • ご利用ガイド
    • Wiki初心者向けガイド(基本操作)
    • このウィキの管理者に連絡
    • 運営会社に連絡(不具合、障害など)
autohotkey_v2 @ ウィキ
  • ウィキ募集バナー
  • 目安箱バナー
  • 操作ガイド
  • 新規作成
  • 編集する
  • 全ページ一覧
  • 登録/ログイン
ページ一覧
autohotkey_v2 @ ウィキ
  • ウィキ募集バナー
  • 目安箱バナー
  • 操作ガイド
  • 新規作成
  • 編集する
  • 全ページ一覧
  • 登録/ログイン
ページ一覧
autohotkey_v2 @ ウィキ
  • 新規作成
  • 編集する
  • 登録/ログイン
  • 管理メニュー
管理メニュー
  • 新規作成
    • 新規ページ作成
    • 新規ページ作成(その他)
      • このページをコピーして新規ページ作成
      • このウィキ内の別ページをコピーして新規ページ作成
      • このページの子ページを作成
    • 新規ウィキ作成
  • 編集
    • ページ編集
    • ページ編集(簡易版)
    • ページ名変更
    • メニュー非表示でページ編集
    • ページの閲覧/編集権限変更
    • ページの編集モード変更
    • このページにファイルをアップロード
    • メニューを編集
    • 右メニューを編集
  • バージョン管理
    • 最新版変更点(差分)
    • 編集履歴(バックアップ)
    • アップロードファイル履歴
    • ページ操作履歴
  • ページ一覧
    • このウィキの全ページ一覧
    • このウィキのタグ一覧
    • このウィキのタグ一覧(更新順)
    • このページの全コメント一覧
    • このウィキの全コメント一覧
    • おまかせページ移動
  • RSS
    • このwikiの更新情報RSS
    • このwikiの新着ページRSS
  • ヘルプ
    • ご利用ガイド
    • Wiki初心者向けガイド(基本操作)
    • このウィキの管理者に連絡
    • 運営会社に連絡する(不具合、障害など)
  • atwiki
  • autohotkey_v2 @ ウィキ
  • キーのリマップ

autohotkey_v2 @ ウィキ

キーのリマップ

最終更新:2023年03月05日 23:43

autohotkey_v2

- view
メンバー限定 登録/ログイン

Table of Contents Introduction Remapping the Keyboard and Mouse Remarks Moving the Mouse Cursor via the Keyboard Remapping via the Registry's "Scancode Map" Related Topics Introduction Limitation: AutoHotkey's remapping feature described below is generally not as pure and effective as remapping directly via the Windows registry. For the advantages and disadvantages of each approach, see registry remapping.

Remapping the Keyboard and Mouse The syntax for the built-in remapping feature is OriginKey::DestinationKey. For example, a script consisting only of the following line would make A behave like B:

a::b The above example does not alter B itself. B would continue to send the "b" keystroke unless you remap it to something else as shown in the following example:

a::b b::a The examples above use lowercase, which is recommended for most purposes because it also remaps the corresponding uppercase letters (that is, it will send uppercase when CapsLock is "on" or Shift is held down). By contrast, specifying an uppercase letter on the right side forces uppercase. For example, the following line would produce an uppercase B when you type either "a" or "A" (as long as CapsLock is off):

a::B Conversely, any modifiers included on the left side but not the right side are automatically released when the key is sent. For example, the following two lines would produce a lowercase "b" when you press either Shift+A or Ctrl+A:

A::b ^a::b Mouse Remapping To remap the mouse instead of the keyboard, use the same approach. For example:

Example Description MButton::Shift Makes the middle button behave like Shift. XButton1::LButton Makes the fourth mouse button behave like the left mouse button. RAlt::RButton Makes the right Alt behave like the right mouse button. Other Useful Remappings Example Description CapsLock::Ctrl Makes CapsLock become Ctrl. To retain the ability to turn CapsLock on and off, add the remapping +CapsLock::CapsLock first. This toggles CapsLock on and off when you hold down Shift and press CapsLock. Because both remappings allow additional modifier keys to be held down, the more specific +CapsLock::CapsLock remapping must be placed first for it to work. XButton2::^LButton Makes the fifth mouse button (XButton2) produce a control-click. RAlt::AppsKey Makes the right Alt become Menu (which is the key that opens the context menu). RCtrl::RWin Makes the right Ctrl become the right Win. Ctrl::Alt Makes both Ctrl behave like Alt. However, see alt-tab issues. ^x::^c Makes Ctrl+X produce Ctrl+C. It also makes Ctrl+Alt+X produce Ctrl+Alt+C, etc. RWin::Return Disables the right Win by having it simply return. You can try out any of these examples by copying them into a new text file such as "Remap.ahk", then launching the file.

See the Key List for a complete list of key and mouse button names.

Remarks The #HotIf directive can be used to make selected remappings active only in the windows you specify (or while any given condition is met). For example:

HotIf WinActive("ahk_class Notepad")

a::b ; Makes the 'a' key send a 'b' key, but only in Notepad.

HotIf ; This puts subsequent remappings and hotkeys in effect for all windows.

Remapping a key or button is "complete" in the following respects:

Holding down a modifier such as Ctrl or Shift while typing the origin key will put that modifier into effect for the destination key. For example, b::a would produce Ctrl+A if you press Ctrl+B. CapsLock generally affects remapped keys in the same way as normal keys. The destination key or button is held down for as long as you continue to hold down the origin key. However, some games do not support remapping; in such cases, the keyboard and mouse will behave as though not remapped. Remapped keys will auto-repeat while being held down (except keys remapped to become mouse buttons). Although a remapped key can trigger normal hotkeys, by default it cannot trigger mouse hotkeys or hook hotkeys (use ListHotkeys to discover which hotkeys are "hook"). For example, if the remapping a::b is in effect, pressing Ctrl+Alt+A would trigger the ^!b hotkey only if ^!b is not a hook hotkey. If ^!b is a hook hotkey, you can define ^!a as a hotkey if you want Ctrl+Alt+A to perform the same action as Ctrl+Alt+B. For example:

a::b ^!a:: ^!b::ToolTip "You pressed " ThisHotkey Alternatively, #InputLevel can be used to override the default behaviour. For example:

InputLevel 1

a::b

InputLevel 0

^!b::ToolTip "You pressed " ThisHotkey If SendMode is used during script startup, it affects all remappings. However, since remapping uses Send "{Blind}" and since the SendPlay mode does not fully support {Blind}, some remappings might not function properly in SendPlay mode (especially Ctrl, Shift, Alt, and Win). To work around this, avoid using SendMode "Play" during script startup when you have remappings; then use the function SendPlay vs. Send in other places throughout the script. Alternatively, you could translate your remappings into hotkeys (as described below) that explicitly call SendEvent vs. Send.

If DestinationKey is meant to be {, it has to be escaped, for example, x::`{. Otherwise it is interpreted as the opening brace for the hotkey's function.

When a script is launched, each remapping is translated into a pair of hotkeys. For example, a script containing a::b actually contains the following two hotkeys instead:

*a:: { SetKeyDelay -1 ; If the destination key is a mouse button, SetMouseDelay is used instead. Send "{Blind}{b DownR}" ; DownR is like Down except that other Send functions in the script won't assume "b" should stay down during their Send. }

*a up:: { SetKeyDelay -1 ; See note below for why press-duration is not specified with either of these SetKeyDelays. Send "{Blind}{b Up}" } However, the above hotkeys vary under the following circumstances:

When the source key is the left Ctrl and the destination key is Alt, the line Send "{Blind}{LAlt DownR}" is replaced by Send "{Blind}{LCtrl up}{LAlt DownR}". The same is true if the source is the right Ctrl, except that {RCtrl up} is used. When a keyboard key is being remapped to become a mouse button (e.g. RCtrl::RButton), the hotkeys above use SetMouseDelay in place of SetKeyDelay. In addition, the first hotkey above is replaced by the following, which prevents the keyboard's auto-repeat feature from generating repeated mouse clicks: RCtrl:: { SetMouseDelay -1 if not GetKeyState("RButton") ; i.e. the right mouse button isn't down yet. Send "{Blind}{RButton DownR}" } When the source is a custom combination, the wildcard modifier () is omitted to allow the hotkeys to work. Note that SetKeyDelay's second parameter (press duration) is omitted in the hotkeys above. This is because press-duration does not apply to down-only or up-only events such as {b down} and {b up}. However, it does apply to changes in the state of the modifier keys (Shift, Ctrl, Alt, and Win), which affects remappings such as a::B or a::^b. Consequently, any press-duration a script puts into effect during script startup will apply to all such remappings.

Since remappings are translated into hotkeys as described above, the Suspend function affects them. Similarly, the Hotkey function can disable or modify a remapping. For example, the following two functions would disable the remapping a::b.

Hotkey "a", "Off" Hotkey "a up", "Off" Alt-tab issues: If you remap a key or mouse button to become Alt, that key will probably not be able to alt-tab properly. A possible work-around is to add the hotkey *Tab::Send "{Blind}{Tab}" -- but be aware that it will likely interfere with using the real Alt to alt-tab. Therefore, it should be used only when you alt-tab solely by means of remapped keys and/or alt-tab hotkeys.

In addition to the keys and mouse buttons on the Key List page, the source key may also be a virtual key (VKnn) or scan code (SCnnn) as described on the special keys page. The same is true for the destination key except that it may optionally specify a scan code after the virtual key. For example, sc01e::vk42sc030 is equivalent to a::b on most keyboard layouts.

To disable a key rather than remapping it, make it a hotkey that simply returns. For example, F1::return would disable F1.

The following keys are not supported by the built-in remapping method:

The mouse wheel (WheelUp/Down/Left/Right). "Pause" as a destination key name (since it matches the name of a built-in function). Instead use vk13 or the corresponding scan code. Curly braces {} as destination keys. Instead use the VK/SC method; e.g. x::+sc01A and y::+sc01B. Moving the Mouse Cursor via the Keyboard The keyboard can be used to move the mouse cursor as demonstrated by the fully-featured Keyboard-To-Mouse script. Since that script offers smooth cursor movement, acceleration, and other features, it is the recommended approach if you plan to do a lot of mousing with the keyboard. By contrast, the following example is a simpler demonstration:

#up::MouseMove 0, -10, 0, "R" ; Win+UpArrow hotkey => Move cursor upward #Down::MouseMove 0, 10, 0, "R" ; Win+DownArrow => Move cursor downward #Left::MouseMove -10, 0, 0, "R" ; Win+LeftArrow => Move cursor to the left #Right::MouseMove 10, 0, 0, "R" ; Win+RightArrow => Move cursor to the right

  • Left-click (hold down Control/Shift to Control-Click or Shift-Click). { SendEvent "{Blind}{LButton down}" KeyWait "RCtrl" ; Prevents keyboard auto-repeat from repeating the mouse click. SendEvent "{Blind}{LButton up}" }

  • Right-click { SendEvent "{Blind}{RButton down}" KeyWait "AppsKey" ; Prevents keyboard auto-repeat from repeating the mouse click. SendEvent "{Blind}{RButton up}" } Remapping via the Registry's "Scancode Map" Advantages:

Registry remapping is generally more pure and effective than AutoHotkey's remapping. For example, it works in a broader variety of games, it has no known alt-tab issues, and it is capable of firing AutoHotkey's hook hotkeys (whereas AutoHotkey's remapping requires a workaround). If you choose to make the registry entries manually (explained below), absolutely no external software is needed to remap your keyboard. Even if you use KeyTweak to make the registry entries for you, KeyTweak does not need to stay running all the time (unlike AutoHotkey). Disadvantages:

Registry remapping is relatively permanent: a reboot is required to undo the changes or put new ones into effect. Its effect is global: it cannot create remappings specific to a particular user, application, or locale. It cannot send keystrokes that are modified by Shift, Ctrl, Alt, or AltGr. For example, it cannot remap a lowercase character to an uppercase one. It supports only the keyboard (AutoHotkey has mouse remapping and some limited joystick remapping). How to Apply Changes to the Registry: There are at least two methods to remap keys via the registry:

Use a program like KeyTweak (freeware) to visually remap your keys. It will change the registry for you. Remap keys manually by creating a .reg file (plain text) and loading it into the registry. This is demonstrated in the archived forums. Related Topics List of keys and mouse buttons GetKeyState Remapping a joystick

「キーのリマップ」をウィキ内検索
LINE
シェア
Tweet
autohotkey_v2 @ ウィキ
記事メニュー

メニュー

  • クイック リファレンス
  • 使い方と文法
    • プログラムの使い方
    • 概念と表記法
    • ホットキー
    • ホットストリング
    • キーのリマップ
    • キーリスト

  • メニュー
  • 右メニュー



リンク

  • @wiki
  • @wikiご利用ガイド




ここを編集
記事メニュー2

更新履歴

取得中です。


ここを編集
人気記事ランキング
  1. プログラムの使い方
  2. キーリスト
  3. プログラムの使用
  4. プラグイン/コメント
もっと見る
最近更新されたページ
  • 818日前

    ホットキー
  • 818日前

    プログラムの使い方
  • 818日前

    クイック リファレンス
  • 818日前

    概念と表記法
  • 818日前

    メニュー
  • 818日前

    キーリスト
  • 818日前

    キーのリマップ
  • 818日前

    ホットストリング
  • 818日前

    スクリプト言語
  • 818日前

    概念と表記法 00
もっと見る
人気記事ランキング
  1. プログラムの使い方
  2. キーリスト
  3. プログラムの使用
  4. プラグイン/コメント
もっと見る
最近更新されたページ
  • 818日前

    ホットキー
  • 818日前

    プログラムの使い方
  • 818日前

    クイック リファレンス
  • 818日前

    概念と表記法
  • 818日前

    メニュー
  • 818日前

    キーリスト
  • 818日前

    キーのリマップ
  • 818日前

    ホットストリング
  • 818日前

    スクリプト言語
  • 818日前

    概念と表記法 00
もっと見る
ウィキ募集バナー
新規Wikiランキング

最近作成されたWikiのアクセスランキングです。見るだけでなく加筆してみよう!

  1. R.E.P.O. 日本語解説Wiki
  2. SYNDUALITY Echo of Ada 攻略 ウィキ
  3. ガンダムGQuuuuuuX 乃木坂46部@wiki
  4. シュガードール情報まとめウィキ
  5. ありふれた職業で世界最強 リベリオンソウル @ ウィキ
  6. ドタバタ王子くん攻略サイト
  7. パズル&コンクエスト(Puzzles&Conquest)攻略Wiki
  8. STAR WARS ジェダイ:サバイバー攻略 @ ウィキ
  9. 機動戦士ガンダム EXTREME VS.2 INFINITEBOOST wiki
  10. Merge Cooking 攻略 @ ウィキ
もっと見る
人気Wikiランキング

atwikiでよく見られているWikiのランキングです。新しい情報を発見してみよう!

  1. アニヲタWiki(仮)
  2. ストグラ まとめ @ウィキ
  3. ゲームカタログ@Wiki ~名作からクソゲーまで~
  4. 初音ミク Wiki
  5. 検索してはいけない言葉 @ ウィキ
  6. 機動戦士ガンダム バトルオペレーション2攻略Wiki 3rd Season
  7. 発車メロディーwiki
  8. Grand Theft Auto V(グランドセフトオート5)GTA5 & GTAオンライン 情報・攻略wiki
  9. 英傑大戦wiki
  10. Fate/Grand Order @wiki 【FGO】
もっと見る
全体ページランキング

最近アクセスの多かったページランキングです。話題のページを見に行こう!

  1. 魔獣トゲイラ - バトルロイヤルR+α ファンフィクション(二次創作など)総合wiki
  2. 参加者一覧 - ストグラ まとめ @ウィキ
  3. 凛子用語集 - 凛子@wiki
  4. ONE. - アニヲタWiki(仮)
  5. 仄々山 すごす - ストグラ まとめ @ウィキ
  6. ロスサントス救急救命隊 - ストグラ まとめ @ウィキ
  7. 鬼レンチャン(レベル順) - 鬼レンチャンWiki
  8. 無馬 かな - ストグラ まとめ @ウィキ
  9. 雑談・交流掲示板 - 星の翼(Starward) 日本語wiki @ ウィキ
  10. 猫耳 ぽこ太郎 - ストグラ まとめ @ウィキ
もっと見る

  • このWikiのTOPへ
  • 全ページ一覧
  • アットウィキTOP
  • 利用規約
  • プライバシーポリシー

2019 AtWiki, Inc.