尝试创建带有下拉列表的 ahk 以打开互联网链接(针对公司)。当我创建时,注意到错误和错误,但我无法修复它。首先它运行整个脚本,我有大约 80 个链接,最后一个链接我必须等待 80 秒才能打开它,其次有时在显示隐藏图标区域它会打开多个 ahk 脚本... 我也尝试使用“运行”功能,
msedge.exe "https://mail.google.com/" " --new-window"
- 但它切断了一半的链接,并且不起作用......所以我想出了剪贴板+粘贴。也许有人可以在这种情况下帮助我,我在哪里犯了错误? AHK 版本 1.1.35.00
Gui, +AlwaysOnTop
; DropDownList:
; Gui, Add, DDL, gAction vChoice Choose1 w200, Page one|Page two| Page three| Page four
; ListBox:
Gui, Add, ListBox, gAction vChoice w200 h60, one|two|three|four
return
; Press F1 to show the gui:
F1::
CoordMode, Mouse, Screen
MouseMove, 40, 50, 0
Gui, Show, x0 y0, Actions
return
Action:
Gui, Submit ; or
if (Choice = "Page one")
Run, msedge.exe
Sleep 1000
clipboard := "page link"
Send ^v
Send {enter}
if (Choice = "Page two")
Run, msedge.exe
Sleep 1000
clipboard := "page link"
Send ^v
Send {enter}
if (Choice = "Page three")
Run, msedge.exe
Sleep 1000
clipboard := "page link"
Send ^v
Send {enter}
if (Choice = "Page four")
Run, msedge.exe
Sleep 1000
clipboard := "page link"
Send ^v
Send {enter}
return
GuiClose:
ExitApp
试试这个:
; Replace all % by `% in the web addresses
My_Webpages =
(
autohotkey questions - Stackoverflow | https://stackoverflow.com/questions/tagged/autohotkey
windows-10 questions - Stackoverflow | https://stackoverflow.com/questions/tagged/windows-10
command-line questions - Stackoverflow | https://stackoverflow.com/questions/tagged/command-line
)
Loop, parse, My_Webpages, `n
{
page_name := StrSplit(A_LoopField," | ").1
list .= page_name "|"
}
Gui, +AlwaysOnTop
Gui, Add, DDL, gAction vChoice w300 h60, % list
Gui, Show, x0 y0, Web pages
return
Action:
Gui, Submit, NoHide
Loop, parse, My_Webpages, `n
{
If InStr(A_LoopField, Choice)
{
page := StrSplit(A_LoopField," | ").2
Run, msedge.exe "%page%" --new-window"
break
}
}
return
确保网址中的所有百分号 (%) 均已 转义 (`%)。