AutoHotKey V2可以复制URL吗?

huangapple go评论41阅读模式
英文:

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}"
}

huangapple
  • 本文由 发表于 2023年6月5日 17:41:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76405170.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定