AutoHotKey 下拉列表可在 ME 上打开链接

AutoHotKey 下拉列表可在 ME 上打开链接

尝试创建带有下拉列表的 AutoHotKey 来打开互联网链接(供公司使用)。创建时,我注意到错误和失误,我无法修复它。

首先,它运行整个脚本,我有大约 80 个链接,对于最后一个链接,我必须等待 80 秒才能打开它,其次,有时在显示隐藏图标区域,它会打开多个 AutoHotKey 脚本......

我也尝试使用运行功能,msedge.exe“页面链接”“--new-window” - 但它切断了一半的链接,并且不起作用......所以我想到了剪贴板+粘贴。也许有人可以帮助我,在这种情况下我在哪里犯了错误?AutoHotKey 版本 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

答案1

尝试这样的操作:

My_links =
(
autohotkey questions - Super User | https://superuser.com/questions/tagged/autohotkey
windows-10 questions - Super User | https://superuser.com/questions/tagged/windows-10
command-line questions - Super User | https://superuser.com/questions/tagged/command-line
)

Loop, parse, My_links, `n
{
    page_name := StrSplit(A_LoopField," | ").1
    list .= page_name  "|"
}

Gui, +AlwaysOnTop
Gui, Add, ListBox, gAction vChoice w300 h60, %list%
return

; Press F1 to show the gui:
F1::
CoordMode, Mouse, Screen
MouseMove, 40, 50, 0
Gui, Show, x0 y0, Actions
return

Action:
Gui, Submit
Loop, parse, My_links, `n
{
    If InStr(A_LoopField, Choice)
    {
        page := StrSplit(A_LoopField," | ").2
        Run, msedge.exe "%page%" --new-window"
        break
    }
}
return

相关内容