【问题标题】:AHK: Paste into NotepadAHK:粘贴到记事本
【发布时间】:2023-02-04 14:09:13
【问题描述】:

我只想将当前剪贴板内容粘贴到新的记事本窗口中,但以下内容不起作用:

#t::
    Run "notepad.exe"
    WinWaitActive, Untitled - Notepad
    WinActivate, Untitled - Notepad ; to bring the window to the front ?
    ControlSend, Edit1, ^v, ahk_class Notepad
    return

还...

ControlSetText, RichEditD2DPT1, New Text Here

...只有效(写新文本在这里进入记事本)我自己手动点击记事本的文本字段后。

如何通过 AHK 将当前剪贴板项目自动写入新的记事本窗口,最好通过Ctrl+V

【问题讨论】:

    标签: autohotkey


    【解决方案1】:
    Run notepad,,, PID ; runs notepad storing its unique Process ID (PID)
    WinWait, ahk_pid %PID% 
    WinActivate, ahk_pid %PID% 
    WinWaitActive, ahk_pid %PID% 
    SendInput, ^v
    

    https://www.autohotkey.com/docs/v1/lib/Run.htm#Parameters

    【讨论】:

    【解决方案2】:

    这应该有效:

    ^v::
        Run "notepad.exe"
        WinWaitActive, ahk_exe notepad.exe
        ControlSend, Edit1, ^v, ahk_class Notepad
        return
    

    【讨论】:

    • ......但不幸的是,事实并非如此。
    猜你喜欢
    • 1970-01-01
    • 2013-05-16
    • 1970-01-01
    • 2019-02-25
    • 2013-02-13
    • 1970-01-01
    • 1970-01-01
    • 2019-07-09
    • 1970-01-01
    相关资源
    最近更新 更多