Jump to content
Sign in to follow this  
lordsocke

Read out URL from .txt

Recommended Posts

Look at the following in the help file:

  • FileReadToArray(filename)
  • For..In Loop (For $element in $aArray) to loop through each line in the file
  • StringInStr - If StringInStr($element, "mytext") Then DoSomething.

Share this post


Link to post
Share on other sites

Something like this? Finishes in just over a second for me on a 3MB file full of URLs.

#include <Array.au3>
#include <FileConstants.au3>

$sFile1 = FileOpen(@DesktopDir & "\1.txt", $FO_READ)
$sFile2 = FileOpen(@DesktopDir & "\2.txt", $FO_APPEND)

Local $aArray = FileReadToArray($sFile1)
    For $element in $aArray
        If StringInStr($element, "aslpro.com") Then FileWriteLine($sFile2, $element)
    Next

FileClose($sFile1)
FileClose($sFile2)
Edited by JLogan3o13

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  

×
×
  • Create New...