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.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
ElizaElizaiubi pe Simpatie
Femeie
23 ani
Satu Mare
cauta Barbat
23 - 53 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [WINDOWS] Change Default Browser Programatically [VBS] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 748
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:

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:

Tested in Windows 7 and it works.

Modificat de TRaP (acum 5 ani)


pus acum 5 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 748
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:

Modificat de TRaP (acum 5 ani)


pus acum 5 ani
   
Pagini: 1  

Mergi la