 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Sun Oct 24, 2004 3:50 pm Post subject: Default Browser |
|
|
Hi, would it be possible to have variable which contained the location of the default browser. So, for example, to run a website you could just put something like-
run, %browser% "www.google.com"
and you would know that it would open in the users prefered browser and in a new window (rather than loading in an existing wndow)
You can probably already do this using regread but it would be nice to have a built-in variable which would stored this information.
Thanks, Jon |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun Oct 24, 2004 7:15 pm Post subject: |
|
|
You can launch a site in the default browser by lauching a plain URL:
Run, www.yahoo.com
This also works for the default e-mail client:
Run, mailto:someone@anywhere.com |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Sun Oct 24, 2004 7:31 pm Post subject: |
|
|
Depending on the browser you are using and the browsers settings, it won't always open the browser in a new window. It will open in a browser window which is already loaded. This is a problem in the script I have made because the user is looking at one web page which needs to be open all the time and when the script runs a website it will load in the browser window that they need to keep open.
If you specify the browser location and pass the website as a parameter then it will load in a new window.
Thanks, Jon |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Tue Oct 26, 2004 9:33 pm Post subject: |
|
|
Hi, Does anyone know if this returns the default browser location on all version of windows? I know It works on XP home.
| Code: | RegRead, OutputVar, HKEY_CLASSES_ROOT, http\shell\open\command
msgbox, %Outputvar% |
Thanks, Jon |
|
| Back to top |
|
 |
exhueydriver
Joined: 12 Jul 2004 Posts: 51 Location: Fife,Wa
|
Posted: Wed Oct 27, 2004 2:24 am Post subject: |
|
|
Works in XP Pro, but that's probably not any big news.
Don |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Oct 27, 2004 10:13 am Post subject: |
|
|
Thanks exhueydriver. I wasn't sure what operating system it would work on. Not even XP Pro.
I should be able to test it on windows 95 tonight. If it works on that, it should work on anything .
One problem I did find was that when I set mozilla as default, the above script reported the previous browser I tested as being default. I also noticed that even though mozilla was default, it wasn't default for opening HTML files which is what I think that registry entry belongs to.
Another way (and probably easier) would be for me to set up a GUI to allow the user to specify which browser they want to use if they don't want it to open in IE.
Thanks, Jon |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5026 Location: imaginationland
|
Posted: Thu Oct 28, 2004 11:24 am Post subject: |
|
|
| Code: | Run, IExplorer.exe
Run, http://www.google.com |
The above code would open a new IE window and visit Google. I still think you default browser idea is cool.  _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Thu Oct 28, 2004 11:23 pm Post subject: |
|
|
| Titan wrote: | | Code: | Run, IExplorer.exe
Run, http://www.google.com |
The above code would open a new IE window and visit Google. I still think you default browser idea is cool.  |
Hi Titan, thanks for the suggestion. The problem with that is knowing how long it will be before the browser starts up. You could end up with two browser windows open. I could do something like this instead which should open up a new window-
| Code: |
run, Iexplore.exe http://www.google.com
|
That is a possibilty since most people would have IE installed.
Another possibilty would be to ask the user whether they want thier registry settings for IE changed since there is a setting in IE which will allow you to disable the reuse of IE windows. That would only work for IE 5 and above though.
What I was thinging of doing was something like this-
| Code: |
;Gets default broser from registry
RegRead, OutputVar, HKEY_CLASSES_ROOT, http\shell\open\command
StringReplace, OutputVar, OutputVar,"
SplitPath, OutputVar,,OutDir,,OutNameNoExt, OutDrive
browser=%OutDir%\%OutNameNoExt%.exe
;runs users default browser.
run, %browser% http://www.aol.co.uk
|
I have a feeling that may cause some problems though.
the way I was doing it before was by tring to find what browser they were using by finding it's class name. This has caused problems with some people though.
All this just to get the browser to open a new window
Thanks, Jon |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|