Jump to content

Recommended Posts

Posted

Hello,

I'm having a condition to copy all urls, having same ending and starting pattern, from source code of a specific website, that's why I write autoit codes but it  only copy very first matched url and exist.

Could you please help me how can I save all the available URLs matching with my pattern given in codes;

 

Here are codes

#RequireAdmin
#include <Excel.au3>
#include <IE.au3>
#include <String.au3>
#include <Array.au3>
Local $oExcel = _Excel_Open()
Local $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\Urls.xlsx", True)
ProcessClose ( "iexplore.exe")
$file = fileopen(@scriptdir & "\source.txt", 10)
$IE = _IECreate(_Excel_RangeRead ($oWorkbook1, Default, "A1"), 0, 0 )
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)
$target_source2 = _StringBetween($source, 'http://example.com/posts/', '/"')
If Not @error Then
FileWrite (@scriptdir & "\links.txt", 'http://example.com/posts/' & $target_source2[0] & @crlf)
EndIf

Thanks

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
×
×
  • Create New...