和自动热键在 Windows 上,你可以关联快捷方式来打开 URL -网页或链接- 在默认浏览器中使用以下脚本:
^!g::Run https://mail.google.com/
这将打开 Gmail在新标签页中CTRL在按下+ ALT+时在最后一个活动窗口中G。
我该怎么做才能打开 URL在新窗口中反而?
答案1
IE:
Run, iexplore.exe https://mail.google.com/
铬合金:
Run, chrome.exe "https://mail.google.com/" " --new-window "
火狐:
Run, firefox.exe -new-window https://mail.google.com/
微软Edge:
Run, msedge.exe "https://mail.google.com/" " --new-window"
答案2
在 AutoHotkey v2 Alpha 中
谷歌浏览器
Run "chrome.exe https://www.google.com --new-window "
火狐浏览器:
Run "firefox.exe " "-new-window www.google.com/"
Microsoft Edge(Chrome 核心)
Run "msedge.exe www.google.com/ --new-window"
答案3
Autohotkey,使用临时本地文件在默认浏览器中打开 URL。
; Autohotkey, open an URL in the default-browser,
; a "little dirty" trick
; first opening a temporary local file with browser
; (the one which is registered to open local html-files)
; this file contains the javascript command "document.location.href"
; to open the url
url := "https://superuser.com/questions/1410878/how-to-open-a-url-in-a-new-browser-window-with-autohotkey"
; a temporary file, running directory must be writeable
outputFile := "a$$$$$$.html"
if (FileExist(outputFile))
FileDelete, %outputFile%
FileAppend,
(
<html>
<body>
<script>
document.location.href="
),%outputFile%
FileAppend,%url%,%outputFile%
FileAppend,
(
"
</script>
</body>
</html>
),%outputFile%
cmdToRun := "cmd /c " . outputFile
run, %cmdToRun%
sleep,5000
; remove temporary file
if (FileExist(outputFile))
FileDelete, %outputFile%