如何在"OneNote for Windows 10"中使自动热键工作?应用程序(不是OneNote)? [英] How to make autohotkey work in "OneNote for Windows 10" app (not OneNote)?

查看:512
本文介绍了如何在"OneNote for Windows 10"中使自动热键工作?应用程序(不是OneNote)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加程序特定的快捷方式,即仅在OneNote App内部使用的快捷方式,而不是打开应用程序本身的捷径. 这是当前脚本的样子:

I am trying to add a program specific shortcut, i.e. a shortcut to be used inside OneNote App only, and not the short cut for the opening of app itself. Here is how the present script is:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive, ahk_exe OneNote.exe

+Enter::
    Send, {(}!+d{)} 
return

但是以上代码只能在OneNote桌面上使用,而不能用于"OneNote for Windows 10"应用(OW10A);如何使其适用于该商店应用?我找不到用于商店应用程序的.exe在上面的脚本中提及它.

But the above one works in OneNote desktop and not for the "OneNote for Windows 10" app (OW10A); how do I make it work for that store app? I am not able to find .exe for the store app to mention it in the above script.

推荐答案

您可以使用#If-或#IfWinActive-指令来创建上下文相关的热键和热字符串:

You can use the #If- or the #IfWinActive- directive to create context-sensitive hotkeys and hotstrings:

#If WinActive("WinTitle ahk_class WinClass", "WinText", "ExcludeTitle", "ExcludeWinText")

#IfWinActive, WinTitle ahk_class WinClass, WinText, ExcludeTitle, ExcludeWinText

https://autohotkey.com/docs/commands/_If.htm

使用Window Spy获取有关程序窗口的详细信息.

Use Window Spy to get detailled information about the program windows.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, 2 ; Title can be part of the full title

#If WinActive("- OneNote ahk_class ApplicationFrameWindow", "OneNote")

    +Enter:: Send, {(}!+d{)}

    ; Here you can add more program specific shortcuts:
    ; ...

; Here you can add specific shortcuts for another program:

#If WinActive("‎- Microsoft Edge ahk_class ApplicationFrameWindow", "Microsoft Edge")

    +Enter:: MsgBox, You pressed Shift+Enter in Microsoft Edge

#If    ; turn off context sensitivity

这篇关于如何在"OneNote for Windows 10"中使自动热键工作?应用程序(不是OneNote)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆