英文:
Can AutoHotKey V2 copy a URL?
问题
我需要从浏览器导航栏复制URL并粘贴到Excel中(两个程序已经在运行)。
我尝试使用AutoHotKey V2,但无法选择然后复制URL。
您是否期望以下代码能够工作?
#Requires AutoHotkey v2.0
#SingleInstance Force
^!9::{
SetKeyDelay 10,10
WinActivate "Edge"
Send "^l"
Send "^c"
WinActivate "Excel"
Send "^v"
Return
}
英文:
I need to copy URLs from a browser navbar and paste them into Excel (both progs already running).
I'm trying to use AutoHotKey V2, but can't get it to select then copy the URL.
Would you expect the following to work?
#Requires AutoHotkey v2.0
#SingleInstance Force
^!9::{
SetKeyDelay 10,10
WinActivate "Edge"
Send "{LCtrl Down}L{LCtrl Up}"
Send "{LCtrl Down}C{LCtrl Up}"
WinActivate "Excel"
Send "{LCtrl Down}{V}{LCtrl Up}"
Return
}
答案1
得分: 1
#Requires AutoHotkey v2.0
#SingleInstance Force
SetTitleMatchMode 2 ; 如果窗口标题不以指定标题开头
^!9::{
WinActivate "Edge"
WinWaitActive "Edge"
Send "{Ctrl Down}l{Ctrl Up}" ; 大写字母可能触发Shift键
Send "{Ctrl Down}c{Ctrl Up}"
Sleep(300)
WinActivate "Excel"
WinWaitActive "Excel"
Send "{Ctrl Down}v{Ctrl Up}"
}
英文:
#Requires AutoHotkey v2.0
#SingleInstance Force
SetTitleMatchMode 2 ; if the window's title doesn't start with the specified title
^!9::{
WinActivate "Edge"
WinWaitActive "Edge"
Send "{Ctrl Down}l{Ctrl Up}" ; capitals can trigger the Shift key
Send "{Ctrl Down}c{Ctrl Up}"
Sleep(300)
WinActivate "Excel"
WinWaitActive "Excel"
Send "{Ctrl Down}v{Ctrl Up}"
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论