Jump to content
Sign in to follow this  
sjorrel

Non-browser-specific web links

Recommended Posts

I'd like to create a button/link that opens a web page in the user's default browser.

I know I could just use the run command and iexplore.exe - but what if internet explorer isn't installed on that machine?

Is there any way of calling the default browser for that machine?

edit: sorry - just realised there is a similar topic a few questions down - i would delete this post and put the question there, but i don't think thats possible :)

Edited by sjorrel

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Create a text file like this:

[InternetShortcut]
URL=http://www.autoitscript.com/forum/index.php?showtopic=10190

Name it w/ the extension .URL

use the filename.url in a run(@comspec)


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

A complete example:

#include <file.au3>
$URL    = "http://www.autoitscript.com/forum"
$fd     = FileOpen(@TEMPDir & "url.url",2)
if $fd = -1 Then Exit
FileWriteLine($fd,"[InternetShortcut]")
FileWriteLine($fd,"URL=" & $URL)
FileClose($fd)
Run(@comspec & " /c " & chr(34) & @TEMPDir & "url.url" & chr(34))

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

Well this solution is only if you want to use your own browser but here is an example on open your wanted site with CWebPage library...

$dll = DLLOpen("cwebpage.dll")

$hwnd = GUICreate("MediePlayer...",800,600,-1,-1)

DLLCall($dll,"long","EmbedBrowserObject","hwnd",$hwnd)

GUISetState()

DLLCall($dll,"long","DisplayHTMLPage","hwnd",$hwnd,"str","http://www.autoitscript.com/forum")

While 1

$msg = GUIGetMsg()

If $msg = -3 Then ExitLoop

WEnd

$ret = DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$hwnd)

Exit

Func OnAutoItExit()

DLLClose($dll)

EndFunc

This is a very nice library from Jeff Glatt, an old computer guru from the R.I.P. Amiga days...

Kåre :)

Edited by kjactive

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...