Simpatie.ro - matrimoniale
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
deea43 pe Simpatie.ro
Femeie
24 ani
Timis
cauta Barbat
25 - 56 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[WINDOWS] Change Default Browser Programatically [VBS]

Pagini: 1 Moderat de TRaP, TonyTzu
#1
TRaP
Moderator
Postari: 960
I wanted this in order to open some cell hyperlinks from excel in a different browser. I have 3 links on each row (made with CTRL+K Add Hyperlink), of which 1 I want to open in Internet Explorer and 2 I want to open in my default browser which is Firefox.

I've been looking for a way to do an excel trick into opening all links in column N with Internet Explorer and the ones in M and O with Firefox, but haven't found a working fix so far (VBA will open the link if it's written in the cell, not hyperlinked to a word). This is the only viable solution I got: http://mrrrr.3xforum.ro/topic/9/Tutoria ... ul_guides/

Now, in order to change the default browser via VBS (admin rights not needed), make the following 2 VBS files (open notepad and when saving instead of text file choose all files, then add extension .vbs):

For Internet Explorer

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=internet%20explorer"
WScript.Sleep 1200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys " "
WScript.Quit


For Firefox

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=firefox"
WScript.Sleep 1200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys " "
WScript.Quit


The only thing that will show is a small window with your default programs, but it will close pretty fast.

Source:
https://superuser.com/questions/1069346 ... windows-10

Tested in Windows 7 and it works.


 
   
#2
TRaP
Moderator
Postari: 960
Updated.

Added the line:
WScript.Sleep 1000
for each code.

For some reason it needed to wait for 500 ms before Saving. Without that wait time, the window would remain open before saving.

Source:
https://community.spiceworks.com/topic/ ... a-registry


 
   
Pagini: 1  
Mergi la