Jump to content

Open Link from notepad?


gui529
 Share

Recommended Posts

Working on a script, how do I read only first line on a notepad and launch it on google chrome?

example:

notepad will be written...

youtube.com

myspace.com

facebook.com

I want to launch the first line on the notepad on google chrome and close it after 4 seconds.

Link to comment
Share on other sites

$File_Path = "C:\Test.txt"
$file = FileOpen($File_Path, 0)
; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file, 1)
    ShellExecute($line)
Wend

FileClose($file)

if you read the help file about the functions used in above, you 'll get all the info there.

This was just a example...

Link to comment
Share on other sites

I don't think you can ShellExecute a website.

After you read the first line of text with FileReadLine, you can use _IECreate, passing it the line of text as a parameter. That will open the website in Internet Explorer. You'll need to #include <IE.au3>. Be sure to read the help file for these functions.

As far as Google Chrome goes, maybe someone knows about a UDF for it ;)

Link to comment
Share on other sites

Hawk is right. As long as you have at minimum "www." or "http://" as the first strings in the file to run, it will open in the default browser "ftp." or "ftp://" will also open in default browser unless another program is registered to handle those actions. "nntp://" can also be opened if there is an appropriate action associated with it.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...