gui529 Posted September 16, 2010 Share Posted September 16, 2010 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 More sharing options...
HavikTech Posted September 16, 2010 Share Posted September 16, 2010 $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 More sharing options...
apstanto Posted September 16, 2010 Share Posted September 16, 2010 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 More sharing options...
HavikTech Posted September 16, 2010 Share Posted September 16, 2010 i don't know, why people always stated that ShellExecute() does not work for websites. i 've been using this method for years and it works perfect. it opens the page in default browser. Tested many times by myself. Link to comment Share on other sites More sharing options...
Varian Posted September 16, 2010 Share Posted September 16, 2010 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 More sharing options...
apstanto Posted September 16, 2010 Share Posted September 16, 2010 Ok. Always learning! I need a "http://" for shellExecute() to open a website. So gui529's file will need that too. Link to comment Share on other sites More sharing options...
Varian Posted September 16, 2010 Share Posted September 16, 2010 Ok. Always learning! I need a "http://" for shellExecute() to open a website. So gui529's file will need that too.Yes, his file cannot ShellExecute "youtube.com", but "www.youtube.com" or "http://youtube.com" will work Link to comment Share on other sites More sharing options...
hooked Posted September 17, 2010 Share Posted September 17, 2010 (edited) You could put if not StringInStr($line, "http://") then $line = "http://" & $line above shellexecute, then it would run any website... Edited September 17, 2010 by hooked Link to comment Share on other sites More sharing options...
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