Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Registers Mullvad Browser with Default Programs or Default Apps in Windows
- 'Mullvadportable.vbs - created for Firefox Portable by Ramesh Srinivasan for Winhelponline.com
- 'v1.0 17-July-2022 - Initial release. Tested on Mozilla FireFox 102.0.1.0.
- 'v1.1 23-July-2022 - Minor bug fixes.
- 'v1.2 27-July-2022 - Minor revision. Cleaned up the code.
- 'Suitable for all Windows versions, including Windows 10/11.
- 'Tutorial: https://www.winhelponline.com/blog/register-Firefox-portable-with-default-apps/
- 'v1.3 3-Dec-2023 - Minor changes in naming by end user to enable use for Mullvad Browser (Tested 1.3 fully on Windows 10)
- Option Explicit
- Dim sAction, sAppPath, sExecPath, sIconPath, objFile, sbaseKey, sbaseKey2, sAppDesc
- Dim sClsKey, ArrKeys, regkey
- Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
- Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
- Set objFile = oFSO.GetFile(WScript.ScriptFullName)
- sAppPath = oFSO.GetParentFolderName(objFile)
- sExecPath = sAppPath & "\Browser\MullvadBrowser.exe"
- sIconPath = sAppPath & "\Browser\MullvadBrowser.exe"
- sAppDesc = "Mullvad Browser delivers safe, private web browsing. " & _
- "A familiar user interface, enhanced security features including " & _
- "protection from online identity theft, and integrated search let " & _
- "you get the most out of the web."
- 'Quit if MullvadBrowser.exe is missing in the current folder!
- If Not oFSO.FileExists (sExecPath) Then
- MsgBox "Please run this script from Mullvad Browser folder. The script will now quit.", _
- vbOKOnly + vbInformation, "Register Mullvad Browser with Default Apps"
- WScript.Quit
- End If
- If InStr(sExecPath, " ") > 0 Then
- sExecPath = """" & sExecPath & """"
- sIconPath = """" & sIconPath & """"
- End If
- sbaseKey = "HKCU\Software\"
- sbaseKey2 = sbaseKey & "Clients\StartmenuInternet\Mullvad Browser\"
- sClsKey = sbaseKey & "Classes\"
- If WScript.Arguments.Count > 0 Then
- If UCase(Trim(WScript.Arguments(0))) = "-REG" Then Call RegisterMullvadBrowser
- If UCase(Trim(WScript.Arguments(0))) = "-UNREG" Then Call UnRegisterMullvadBrowser
- Else
- sAction = InputBox ("Type REGISTER to add Mullvad Browser to Default Apps. " & _
- "Type UNREGISTER To remove.", "Mullvad Browser Registration", "REGISTER")
- If UCase(Trim(sAction)) = "REGISTER" Then Call RegisterMullvadBrowser
- If UCase(Trim(sAction)) = "UNREGISTER" Then Call UnRegisterMullvadBrowser
- End If
- Sub RegisterMullvadBrowser
- WshShell.RegWrite sbaseKey & "RegisteredApplications\Mullvad Browser", _
- "Software\Clients\StartMenuInternet\Mullvad Browser\Capabilities", "REG_SZ"
- 'MullvadHTML registration
- WshShell.RegWrite sClsKey & "MullvadHTML2\", "Mullvad HTML Document", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadHTML2\EditFlags", 2, "REG_DWORD"
- WshShell.RegWrite sClsKey & "MullvadHTML2\FriendlyTypeName", "Mullvad HTML Document", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadHTML2\DefaultIcon\", sIconPath & ",1", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadHTML2\shell\", "open", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadHTML2\shell\open\command\", sExecPath & _
- " -url " & """" & "%1" & """", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadHTML2\shell\open\ddeexec\", "", "REG_SZ"
- 'MullvadPDF registration
- WshShell.RegWrite sClsKey & "MullvadPDF2\", "Mullvad PDF Document", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadPDF2\EditFlags", 2, "REG_DWORD"
- WshShell.RegWrite sClsKey & "MullvadPDF2\FriendlyTypeName", "Mullvad PDF Document", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadPDF2\DefaultIcon\", sIconPath & ",5", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadPDF2\shell\open\", "open", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadPDF2\shell\open\command\", sExecPath & _
- " -url " & """" & "%1" & """", "REG_SZ"
- 'MullvadURL registration
- WshShell.RegWrite sClsKey & "MullvadURL2\", "Mullvad URL", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadURL2\EditFlags", 2, "REG_DWORD"
- WshShell.RegWrite sClsKey & "MullvadURL2\FriendlyTypeName", "Mullvad URL", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadURL2\URL Protocol", "", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadURL2\DefaultIcon\", sIconPath & ",1", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadURL2\shell\open\", "open", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadURL2\shell\open\command\", sExecPath & _
- " -url " & """" & "%1" & """", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadURL2\shell\open\ddeexec\", "", "REG_SZ"
- 'Default Apps Registration/Capabilities
- WshShell.RegWrite sbaseKey2, "Mullvad Browser", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationDescription", sAppDesc, "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationIcon", sIconPath & ",0", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationName", "Mullvad Browser", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.pdf", "MullvadPDF2", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "Capabilities\StartMenu", "Mullvad Browser", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "DefaultIcon\", sIconPath & ",0", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "shell\open\command\", sExecPath, "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "shell\properties\", "Mullvad &Options", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "shell\properties\command\", sExecPath & " -preferences", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "shell\safemode\", "Mullvad &Safe Mode", "REG_SZ"
- WshShell.RegWrite sbaseKey2 & "shell\safemode\command\", sExecPath & " -safe-mode", "REG_SZ"
- ArrKeys = Array ( _
- "FileAssociations\.avif", _
- "FileAssociations\.htm", _
- "FileAssociations\.html", _
- "FileAssociations\.shtml", _
- "FileAssociations\.svg", _
- "FileAssociations\.webp", _
- "FileAssociations\.xht", _
- "FileAssociations\.xhtml", _
- "URLAssociations\http", _
- "URLAssociations\https", _
- "URLAssociations\mailto" _
- )
- For Each regkey In ArrKeys
- WshShell.RegWrite sbaseKey2 & "Capabilities\" & regkey, "MullvadHTML2", "REG_SZ"
- Next
- 'Override the default app name by which the program appears in Default Apps (*Optional*)
- '(i.e., -- "Mozilla FireFox, Portable Edition" Vs. "Firefox Portable")
- 'The official Mozilla Firefox setup doesn't add this registry key.
- WshShell.RegWrite sClsKey & "MullvadHTML2\Application\ApplicationIcon", sIconPath & ",0", "REG_SZ"
- WshShell.RegWrite sClsKey & "MullvadHTML2\Application\ApplicationName", "Mullvad Browser", "REG_SZ"
- 'Launch Default Programs or Default Apps after registering Mullvad Browser
- WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"
- End Sub
- Sub UnRegisterMullvadBrowser
- sbaseKey = "HKCU\Software\"
- sbaseKey2 = "HKCU\Software\Clients\StartmenuInternet\Mullvad Browser"
- On Error Resume Next
- WshShell.RegDelete sbaseKey & "RegisteredApplications\Mullvad Browser"
- On Error GoTo 0
- WshShell.Run "reg.exe delete " & sClsKey & "MullvadHTML2" & " /f", 0
- WshShell.Run "reg.exe delete " & sClsKey & "MullvadPDF2" & " /f", 0
- WshShell.Run "reg.exe delete " & sClsKey & "MullvadURL2" & " /f", 0
- WshShell.Run "reg.exe delete " & chr(34) & sbaseKey2 & chr(34) & " /f", 0
- 'Launch Default Apps after unregistering Mullvad Browser
- WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement