Jump to content
Sign in to follow this  
t0ddie

uhm, webbrowser......

Recommended Posts

this solution works best for me.

$Url = "http://www.com"
$OpenUrl = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command", "")
$PosParam = StringInStr($OpenUrl, "%")
$OpenUrlLeft = StringLeft($OpenUrl, $PosParam - 1)
$OpenUrlRight = StringMid($OpenUrl, $PosParam + 2, 999)
Run($OpenUrlLeft & $Url & $OpenUrlRight)

can you tell me what windows versions this wont work on?

is there another way to do this on those versions?

:(

<{POST_SNAPBACK}>

Unfortunately, it didn't make sense, because it was the same as what I programmed the script on: It was XP Pro SP2.

It really only happened in one instance, and I basically did this:

$Url = ""
         Run(@ComSpec & " /c Start " & $Url, "", @SW_HIDE)
         If @error Then
            $Url = ""
            $OpenUrl = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command", "")
            $PosParam = StringInStr($OpenUrl, "%") 
            $OpenUrlLeft = StringLeft($OpenUrl, $PosParam - 1)
            $OpenUrlRight = StringMid($OpenUrl, $PosParam + 2, 999)of the path
            Run($OpenUrlLeft & $Url & $OpenUrlRight)
         EndIf

Hope all this helps


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.

Share this post


Link to post
Share on other sites

I was reading through this topic trying to find a cleaner way to open a web page than @ComSpec /c start (which I've used in the past) and I realized the answer was staring me in the face the whole time. I noticed in @SmOke_N's sig, the DllCall to ShellExecute to open the AutoIt and SciTe download pages. Sure enough, the following code works great:

Dim $page = @ScriptDir & "\index.html"
DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", 'open', _
        "string", $page, "string", '', "string", @ScriptDir, "long", @SW_SHOWNORMAL)

That basically tells windows to open the web page in the default application, typically your default browser (I'm not 100% sure but I imagine you can associate HTML files with another program and still have your browser handle the HTTP protocol).

I hope this helps someone out.

-QB

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...