- Thread Author
-
- #1
Currently I am using this script to open links in Chrome:
Is it possible to open this in Microsoft Edge? I tried replacing shellExecute line with this objShell.ShellExecute "microsoft-edge:", URL, "", "", 1, but that just opens the Edge with home page, and not the `URL`. Any tips?
Code:
Sub Chrome(URL)
'----------------------------------------------------------------------
' Purpose: Launch Chrome
' Arguments: <URL>
'----------------------------------------------------------------------
if (ubound(split(URL," ")) = 0) then
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", URL, "", "", 1
end if
end Sub
Is it possible to open this in Microsoft Edge? I tried replacing shellExecute line with this objShell.ShellExecute "microsoft-edge:", URL, "", "", 1, but that just opens the Edge with home page, and not the `URL`. Any tips?
- Thread Author
-
- #3
Hm, nothing happens when doing that.Set objShell = CreateObject("WScript.Shell")
objShell.Run "msedge URL"
should work
- Thread Author
-
- #6
Using Windows 10. How would the script look like if using Powershell?Works for me, what version of Windows? Can you use powershell instead?
- Thread Author
-
- #8
So like this?:It's depends how it needs to be called.
If it's a hard coded call then like this
Code:Start-Process -FilePath "msedge" -ArgumentList "https://google.com"
Code:
Sub Chrome(URL)
'----------------------------------------------------------------------
' Purpose: Launch Chrome
' Arguments: <URL>
'----------------------------------------------------------------------
if (ubound(split(URL," ")) = 0) then
Start-Process -FilePath "msedge" -ArgumentList "URL"
end if
end Sub
- Thread Author
-
- #10
But there are multiple function in my .vbs file that contains lines like this:No you're mixing vbs and powershell. It's just the one line
Code:
Chrome "https://domain.my.salesforce.com/apex/ScreenPopView?nr=&cID=" + Params.ParamByName("cID") + "&crpnr=" + NR
And that
Code:
Chrome
Code:
Sub Chrome(URL)
Code:
Start-Process -FilePath "msedge" -ArgumentList
- Thread Author
-
- #12
The .vbs file is 4000 lines of code, so I was hoping to find a easier solution.Visual Basic and PowerShell are different languages you can't mix the code in a script. I was suggesting to just convert your code to Powershell, it's much simpler to write.
- Joined
- Jul 4, 2015
- Messages
- 8,998
Some slight modification to the original code I suggested (VBS)
Code:
Dim URL
URL = "https://google.com"
Dim shell
Set Shell = CreateObject("WScript.Shell")
Shell.Run """" & "microsoft-edge://" & URL & """"
Probably a difference in Windows 10 versions. Both microsoft-edge: and microsoft-edge:// work on mine
Both are calling the edge protocol. Great job.
Similar threads
- Article
- Replies
- 0
- Views
- 83
- Replies
- 0
- Views
- 2K
- Solved
- Replies
- 1
- Views
- 3K