在不同的浏览器中打开网址

Open URLs in different browsers

global AssocArray := {}
Array := []
Loop, Read, links.txt
    Array.Push(StrSplit(A_LoopReadLine, ";"))
for index, element in Array {
    Browser := Func("Launch").Bind("chrome.exe --options ", "firefox.exe -options ")
    Menu, MyMenu, Add, % element.2, % Browser
    AssocArray[element.2] := element.3
}
Menu, MyMenu, Show

Launch(BrowserPC1, BrowserPC2, ItemName, ItemPos) {
    Browser := A_ComputerName = PC1 ? %BrowserPC1% : %BrowserPC2%
    Run, % Browser AssocArray[ItemName]
    return
}

Format of links.txt:
;Arrays;https://autohotkey.com/docs/Arrays

如何在 Launch 中使用不同的浏览器,具体取决于我使用的是 PC1 还是 PC2,以及我为不同菜单指定的浏览器(这就是为什么我有不是简单地在 Launch 中指定它们)?由于(我假设)破折号,我收到了非法字符错误。

错误在这里:

Browser := A_ComputerName = PC1 ? %BrowserPC1% : %BrowserPC2%

您正在尝试使用动态变量。
在表达式语句中,您不会通过将变量包装在 % 中的传统 AHK 方式来引用变量。您只需简单地输入他们的名字,就像这样:

Browser := A_ComputerName = PC1 ? BrowserPC1 : BrowserPC2

另一件事。应该在哪里定义变量 PC1
您是否打算将其用作文字字符串 ("PC1")?