Sign in to follow this  
Followers 0
Ejoc

BrowseURL

13 posts in this topic

I posted a version of this in a couple of threads, this opens a url using your default web browser:

#include-once
#include <file.au3>

Func BrowseURL($URL)
    Local $fd

    $fd     = FileOpen(@TEMPDir & "url.url",2)
    if $fd = -1 Then return -1
    FileWriteLine($fd,"[InternetShortcut]")
    FileWriteLine($fd,"URL=" & $URL)
    FileClose($fd)
    Run(@comspec & " /c " & chr(34) & @TEMPDir & "url.url" & chr(34))
    return 0
EndFunc

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



1. You are not as noob as I thought.

2. I just made two smaller versions

BrowseURL_1('http://www.autoitscript.com')
Sleep(5000)
BrowseURL_2('http://www.autoitscript.com')

Func BrowseURL_1($URL)
    Local $TempFile
    $TempFile = @TempDir & "\Website.url"
    INIWrite($TempFile, "InternetShortcut", "URL", $URL)
    Run(@comspec & ' /c "' & $TempFile & '"', @SystemDir, @SW_HIDE)
EndFunc
 
Func BrowseURL_2($URL)
    Run(@comspec & ' /c START "" "' & $URL & '"', @SystemDir, @SW_HIDE)
EndFunc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i don't know whats better but i usually just do this

Run ( @ComSpec & " /c start http://www.autoitscript.com" )

edit:

this version doesn't show a black command box

Run ( @ComSpec & " /c start http://www.autoitscript.com", @SystemDir, @SW_HIDE )
Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

1. You are not as noob as I thought.

:) I'm still a noob, I've only been using AutoIt for like a month :D

2. I just made two smaller versions

BrowseURL_1('http://www.autoitscript.com')
Sleep(5000)
BrowseURL_2('http://www.autoitscript.com')

Func BrowseURL_1($URL)
    Local $TempFile
    $TempFile = @TempDir & "\Website.url"
    INIWrite($TempFile, "InternetShortcut", "URL", $URL)
    Run(@comspec & ' /c "' & $TempFile & '"', @SystemDir, @SW_HIDE)
EndFunc
 
Func BrowseURL_2($URL)
    Run(@comspec & ' /c START "" "' & $URL & '"', @SystemDir, @SW_HIDE)
EndFunc

<{POST_SNAPBACK}>

I like the use of INIWrite.

I was trying to remember how to do a URL on the command line, I forgot the START

I like the BrowseURL_2 method

Edited by Ejoc

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

And for those of you using Autoit w/COM:

_OpenWeb("http://www.autoitscript.com")

Func _OpenWeb($URL)
    $oWeb = ObjCreate("Shell.Application")
    $oWeb.Open($URL)
EndFunc

Tested with IE6 and Firefox 1.02


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites

I just tested the com and it works with Avant too and that browser is pretty unstable


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

And for those of you using Autoit w/COM:

What is Autoit w/COM?


Sorry, which my English is so bad. I come from Switzerland ;-)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

this one (latest version if im correct) has com support. look it up in the help file :)

http://www.autoitscript.com/forum/index.php?showtopic=10256

get it here: http://www.autoitscript.com/fileman/users/jpm/AutoIt3-gui/

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

this one (latest version if im correct) has com support. look it up in the help file  :)

http://www.autoitscript.com/forum/index.php?showtopic=10256

get it here: http://www.autoitscript.com/fileman/users/jpm/AutoIt3-gui/

<{POST_SNAPBACK}>

When will there be a version released where you can compile the COM options because i love them :D Maybe the next version or does a compliler exists?

Share this post


Link to post
Share on other sites

When will there be a version released where you can compile the COM options because i love them :) Maybe the next version or does a compliler exists?

<{POST_SNAPBACK}>

just copy the .bin from the .zip to the aut2exe folder

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

just copy the .bin from the .zip to the aut2exe folder

<{POST_SNAPBACK}>

Man i'am feeling stupid! Thnx man! :)

Share this post


Link to post
Share on other sites

I like it this way... :)

_ShellExec("http://www.autoitscript.com")

Func _ShellExec($sCmd, $sVerb = "open", $sArg = "", $sFolder = @ScriptDir, $parent_hwnd = 0, $state = @SW_SHOWNORMAL)
  Local $aRet
  $aRet = DllCall("shell32.dll", "long", "ShellExecute", "hwnd", $parent_hwnd, "string", $sVerb, _
        "string", $sCmd, "string", $sArg, "string", $sFolder, "long", $state)
  Return $aRet
  If $aRet[0] > 32 Then
     Return 1
  Else
     Return 0;Problems
  EndIf
EndFunc

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

_BrowseURL("www.autoitscript.com")

Func _BrowseURL($url="")
   $x = RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", "")
   Run($x & " " & $url)
EndFunc

(tested only with: Windows 2k German)

Edited by silvanr

Sorry, which my English is so bad. I come from Switzerland ;-)

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  
Followers 0