Jump to content

Replacing the default web browser by your own script


dbenoit
 Share

Recommended Posts

Hello the World,

I would like to replace the default web browser by my my Autoit script.

For example, when I click on http://autoitscrip.com I would like to start the following script

$param = $CmdLineRaw

MsgBox(0,"Yes We Can", "Do you wish to start? " & @lf & $param)

Exit

The problem I misarably fail is simple:

The registry to change are unknown; all search done on Google are not working; all people tells how to set up FireFow or Chrome as default, but never I found the relevant data for starting my own Autoit code.

If some one can help me I would greatly appreciate it.

Kind regards

Dominique Benoit

Link to comment
Share on other sites

  • Moderators

What would you like to set the default to be? I know the following command works for Firefox.

firefox.exe -silent -setDefaultBrowser











Edit:

..and for Chrome. Both tested on WIN7 x64

chrome.exe --make-default-browser



Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Same for Opera too.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Are you trying to implement something similar to Browser Chooser?  It sets itself as the default browser.  Then when you click a link, say in an editor that support links or whatnot, it opens Browser Chooser toolbar and you select which browser from a list of buttons.

I tried to do something similar.  But I found there are so many associations in the registry that it's a real hassle.  Probably the hardest part of the coding for the Browser Chooser author was getting the registry code right.

Edit: The source code to Browser Chooser is available.  Perhaps looking at it may help:

http://browserchooser.codeplex.com/SourceControl/latest

Edit2: I found where he calls

SetDefaultBrowserPath()

but not the definition.  You could download the code if you can read vb.net

Edit3:  A bit more info on reg keys:

http://stackoverflow.com/questions/968449/how-do-i-change-default-browser-using-c-sharp-or-batch-file

Edited by MilesAhead
Link to comment
Share on other sites

Hello,

I have write this code from the various advise but it does not do the job at all

RegWrite("HKEY_CLASSES_ROOT.htm", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOT.html", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOT.shtm", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOT.xht", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOT.xhtm", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOT.xhtml", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOThttpshellopencommand")
RegWrite("HKEY_CLASSES_ROOThttpshellopenddeexecApplication", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOTftpshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_CLASSES_ROOTftpshellopenddeexecApplication", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_CLASSES_ROOTgophershellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_CLASSES_ROOTgophershellopenddeexecApplication", "", "REG_SZ", "MyAutoit")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesMyAutoitDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesMyAutoitshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesgopherDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesgophershellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClasseshttpDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClasseshttpshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesftpDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesftpshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClasseshttpsDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClasseshttpsshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClasseshttpDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClasseshttpshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain", "Check_Associations", "REG_SZ", "No")
RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain", "IgnoreDefCheck", "REG_SZ", "Yes")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClientsStartMenuInternet", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClientsStartMenuInternetMyAutoit.exeDefaultIcon", "", "REG_SZ", "C:testMyAutoit.exe,1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClientsStartMenuInternetMyAutoit.exeshellopencommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClientsStartMenuInternetMyAutoit.exeshellproperties", "", "REG_SZ", "")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClientsStartMenuInternetMyAutoit.exeshellpropertiescommand", "", "REG_SZ", "C:testMyAutoit.exe %1")
 

Kind regards

Dominique

Link to comment
Share on other sites

OR maybe the user should search for _ShellFile(). Hint: Look in my signature.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Are you trying to implement something similar to Browser Chooser? 

To answer this question the answer is no.

What I want to develop is a small utility that can be run under any TSE system.

The goal is to "push" any URL typed inside a server session toward the user side web browser.

The benefit will be obvious: rather than browsing inside a server (which can kill the bandwith if he starts videos or flash animations), the user will automatically redirect the URL to his local browser and his local bandwith.

I have nearly finish this tool.
If I install Opera, and replace Opera.exe by my AutoIt program it works very well :thumbsup:

But I do not want to tell anyone that they must install Opera and use this trick to replace manually opera.exe.

I would like a more "professional" solution which will be to set my autoit code as the "default web browser".

You see?

 

Kind regards

Dominique

Link to comment
Share on other sites

Hello Guinness,

Nice try but it do not do the job either:

_ShellFile_Install("MyAutoIT", "html", "MyAutoit.exe","C:testMyAutoit.exe", "C:testMyAutoit.exe", 0, True, False)

Result: Nothing. I sttl get IE when I click on my test.html test page

Kind regards

Dominique

Link to comment
Share on other sites

  • Moderators

How are you expecting to "manually replace opera.exe" on a machine if it isn't installed?

Why not just call your URL with ShellExecute, like below, and let the local machine decide what browser to open it in?

ShellExecute("www.Google.com")

Or, if you need it to run in Opera, look at virtualizing the application and including it with your script.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

To answer this question the answer is no.

 

If it is or not you are traveling the same road.  I wanted my application to load instead of default browser. I came up with the same hack of search and replace the browser exe in the registry.  If you really want to set your program as default via code then I suggest you post on the BrowserChooser project or ask the author of BrowserTraySwitch

Link to comment
Share on other sites

Hello again,

The goal is not to start a URL.

ShellExecute("www.Google.com")  This is easy and without any problem
The goal is to be able to start one AutoIT script when you run ShellExecute("www.Google.com")  instead to run IE, Opera, Firefox or Chrome.
 
So, If my script is:msgbox(0,"AutoIT", "Hello the World")
When I will run ShellExecute("www.Google.com"), I am expecting to see my pop-up Hello The World (and not at all google.com started from my default web browser).
 
I tried BroswerTraySwitch. It looks not easy to handle. However I will drop a mail to its author.
 
Kind regards
 
Dominique
Link to comment
Share on other sites

try this:

http://msdn.microsoft.com/en-us/library/dd203067(VS.85).aspx

i used it successfully for a purpose very similar to yours.

note: although the title of the article may seem misleading ("How to Register an Internet Browser or Email Client With the Windows Start Menu"), the article has a section called "How to Register as the Default Internet Client", which is exactly what you need.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...