AzKay Posted June 2, 2006 Posted June 2, 2006 Well, i know i may not get many replys, because most of you probly dont know visual basic, but some might, thats why im asking this. Ok, I have a button, called "Forum" when i click the button, i want it to open up the default browser, and go to the url. How can I do this? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Moderators SmOke_N Posted June 2, 2006 Moderators Posted June 2, 2006 Have you looked at the ShellExecute API? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
AzKay Posted June 2, 2006 Author Posted June 2, 2006 Have you looked at the ShellExecute API?no, but i will, thanks # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Sublime Posted June 2, 2006 Posted June 2, 2006 (edited) Well when you tell it to open a window it will automaticly use the default browser if you code it in vb the action for the button would look like this: function opensite(){ var site="http://www.google.com" winopen=window.open(site) } If I understand you correctly just attach this as the button actiaon "opensite()" use that except the google.com part change that and use the mouse click function I am not sure exactly how it is you are trying to go about this? That was "vbscript" is that what you ment or did you mean actual "Visual Basic" Are you trying to write this using autoit code? I have nvr tried using outside programing in autoit so I have nvr looked up autoits functionality with other scripts so. Edited June 2, 2006 by Sublime
mr.underperson Posted June 3, 2006 Posted June 3, 2006 In AutoIt... ; open a URL in the user's "default browser"... func VisitURL($url) $browser_str = RegRead("HKEY_CLASSES_ROOT\HTTP\shell\open\command", "") $browser_str = StringReplace($browser_str, '"%1"', $url) run($browser_str, "", @SW_SHOW) endfunc I don't know about VB, but I know that often opening a URL means getting IE rather than your default browser (*grrr* AutoIt!). The crucial step is checking in the registry first, which I'm sure you can figure out how to do in VB. -mu
MFerris Posted June 3, 2006 Posted June 3, 2006 I can't speak to VB6, but I know I've grappled with this problem in AutoIt before. Suggestions ranged from parsing the registry to find out what the user's preferred browser is, however I recently came across some rediculously easy code. _RunDos("start http://www.google.com") _RunDos is a UDF, basically it runs a DOS command in a hidden window. You can do this manually if you just go to DOS and type 'start (url)'. I'm pretty familiar with DOS and never knew about this. I use firefox. When I ran this command it immediately opened firefox and went to that URL. Pretty nifty. Again, doesn't answer your question about VB6, but seeing as how that's a feature of Windows/DOS and not AutoIt/VB6, you should be able to make it work in VB by issuing that command to the DOS prompt. Good luck.
mr.underperson Posted June 3, 2006 Posted June 3, 2006 Nice! So, even without a UDF, it's simply... Run(@ComSpec & " /c " & "start http://www.google.com", "", @SW_HIDE) Yup! "start" is the key. Noted. Cheers! I guess it would be easy enough to send this command in VB. -mu
Moderators SmOke_N Posted June 3, 2006 Moderators Posted June 3, 2006 This is kind of what I was talking about:Local $Url = 'http://www.google.com' DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", 'open', "string", $Url, "string", '', "string", @ScriptDir, "long", @SW_SHOWNORMAL) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
eltorro Posted June 19, 2006 Posted June 19, 2006 (edited) This is what I use. Run("RunDLL32.EXE url.dll,FileProtocolHandler " & $sURL) Edited June 19, 2006 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
shornw Posted June 19, 2006 Posted June 19, 2006 Try this run("C:\Program Files\Internet Explorer\iexplore.exe www.compaq.com") [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]
Moderators SmOke_N Posted June 19, 2006 Moderators Posted June 19, 2006 Try thisrun("C:\Program Files\Internet Explorer\iexplore.exe www.compaq.com")FireFox is my default browser. And C:\ may not be mapped. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
iqu Posted September 23, 2016 Posted September 23, 2016 This looks goooooood Public Sub OpenDefaultBrowser(weburl As String) Dim r As Long r = ShellExecute(0, "open", weburl, 0, 0, 1) End Sub
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now