VBA 在 TOR 中打开链接(每个都在新标签页中)
VBA To Open Links in TOR (each in a new tab)
你能告诉我如何在 TOR (Firefox) 中打开 selection of links(每个都在单独的选项卡中)吗?
我的代码适用于例如一个实例(一个 link 来自 Excel 中的一个单元格)并在 TOR 中打开它,但如果我 select 多个单元格然后它打开一个然后尝试打开一个新实例TOR 打开另一个(我不能同时打开两个)。
Sub Open_Tor()
'open hyperlink in tor
Dim tor As String
'tor = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
tor = "C:\Users\Lenovo\Desktop\Tor Browser\Browser\firefox.exe"
Dim hl As Hyperlink
On Error Resume Next
For Each hl In Selection.Hyperlinks
Shell (tor & " -url-newtab " & hl.Address)
Next hl
End Sub
如果你没有 TOR,你可以简单地改变你的 Chrome 的路径来测试它(Chrome 会很好地打开一个 link 一个接一个,每个都在一个单独的标签)。
谢谢
PS。由于每天可以在特定服务器上执行的计算限制,我无法使用 Chrome,因此使用了 TOR(它不断更改 IP)。
使用以下两个代码(粘贴在两个单独的模块中)。如果需要,可以在其中一张工作表上添加一个按钮(以触发代码)并将其定向到 EventMacro 代码。请记住将 alertTime
和 Application.Wait
值调整为您机器的 speed/specs。
Sub EventMacro()
alertTime = Now + TimeValue("00:00:08")
OpenInAnotherBrowser Sheet2.Cells(2, 2).Value 'provide a link in this location on a specific sheet (in my case Sheet2)
Application.OnTime alertTime, "EventMacro"
End Sub
现在,多亏了这段代码,您将获得 open/close Tor 浏览器的循环,其中特定的 link 位于 Sheet2.Cells(2, 2)
! :D
Sub OpenInAnotherBrowser(url As String)
Dim firefoxPath As String
Dim wshell As Object
Dim oExec As Object
Set wshell = CreateObject("Wscript.Shell")
firefoxPath = "C:\Users\T14s\Desktop\Tor Browser\Browser\firefox.exe" 'provide path to Tor folder where firefox.exe is based
If Dir(firefoxPath) = "" Then pathFireFox = "C:\Users\T14s\Desktop\Tor Browser\Browser\firefox.exe" 'provide path to Tor folder where firefox.exe is based
Set oExec = wshell.Exec(firefoxPath & " " & url)
Application.Wait (Now + TimeValue("0:00:05")) 'adjust based on your machine's specs
oExec.Terminate
Set wshell = Nothing
Set oExec = Nothing
Application.Wait (Now + TimeValue("0:00:03")) 'adjust based on your machine's specs
Application.SendKeys "^+Q" 'quit Tor
End Sub
你能告诉我如何在 TOR (Firefox) 中打开 selection of links(每个都在单独的选项卡中)吗?
我的代码适用于例如一个实例(一个 link 来自 Excel 中的一个单元格)并在 TOR 中打开它,但如果我 select 多个单元格然后它打开一个然后尝试打开一个新实例TOR 打开另一个(我不能同时打开两个)。
Sub Open_Tor()
'open hyperlink in tor
Dim tor As String
'tor = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
tor = "C:\Users\Lenovo\Desktop\Tor Browser\Browser\firefox.exe"
Dim hl As Hyperlink
On Error Resume Next
For Each hl In Selection.Hyperlinks
Shell (tor & " -url-newtab " & hl.Address)
Next hl
End Sub
如果你没有 TOR,你可以简单地改变你的 Chrome 的路径来测试它(Chrome 会很好地打开一个 link 一个接一个,每个都在一个单独的标签)。
谢谢
PS。由于每天可以在特定服务器上执行的计算限制,我无法使用 Chrome,因此使用了 TOR(它不断更改 IP)。
使用以下两个代码(粘贴在两个单独的模块中)。如果需要,可以在其中一张工作表上添加一个按钮(以触发代码)并将其定向到 EventMacro 代码。请记住将 alertTime
和 Application.Wait
值调整为您机器的 speed/specs。
Sub EventMacro()
alertTime = Now + TimeValue("00:00:08")
OpenInAnotherBrowser Sheet2.Cells(2, 2).Value 'provide a link in this location on a specific sheet (in my case Sheet2)
Application.OnTime alertTime, "EventMacro"
End Sub
现在,多亏了这段代码,您将获得 open/close Tor 浏览器的循环,其中特定的 link 位于 Sheet2.Cells(2, 2)
! :D
Sub OpenInAnotherBrowser(url As String)
Dim firefoxPath As String
Dim wshell As Object
Dim oExec As Object
Set wshell = CreateObject("Wscript.Shell")
firefoxPath = "C:\Users\T14s\Desktop\Tor Browser\Browser\firefox.exe" 'provide path to Tor folder where firefox.exe is based
If Dir(firefoxPath) = "" Then pathFireFox = "C:\Users\T14s\Desktop\Tor Browser\Browser\firefox.exe" 'provide path to Tor folder where firefox.exe is based
Set oExec = wshell.Exec(firefoxPath & " " & url)
Application.Wait (Now + TimeValue("0:00:05")) 'adjust based on your machine's specs
oExec.Terminate
Set wshell = Nothing
Set oExec = Nothing
Application.Wait (Now + TimeValue("0:00:03")) 'adjust based on your machine's specs
Application.SendKeys "^+Q" 'quit Tor
End Sub