gui529 0 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. Share this post Link to post Share on other sites
HavikTech 0 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... Share this post Link to post Share on other sites
apstanto 2 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 Share this post Link to post Share on other sites
HavikTech 0 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. Share this post Link to post Share on other sites
Varian 8 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. Share this post Link to post Share on other sites
apstanto 2 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. Share this post Link to post Share on other sites
Varian 8 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 Share this post Link to post Share on other sites
hooked 0 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 Share this post Link to post Share on other sites