Jump to content
Sign in to follow this  
styles3000

Turning Titles Into href's

Recommended Posts

styles3000

In the script below ,its primary purpose is to copy htm files. But I would would like to enhance it a little.

In addition of what the script is already doing. How can I get autoit to go into D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\0001.txt and extract the string between the title tags<title>Watch Fox.....</title> then go into D:\Documents and Settings\Taevon Jones\Desktop\HOME-MASTER-PHP.htm looking the title tags. Once found, how can I replace the current string(in HOME-MASTER-PHP.htm) with the new string that was extracted from 0001.txt? Their are also tags named <strong></strong>. How can I place the same string from 0001.txt between them?

sleep(5000)
$sTotalFiles = _GetFileCount("D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\")
;MsgBox(0,'Total Files',$sTotalFiles)
sleep(5000)
$Firstline = 'christmas greetings'
DirCreate('D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline)
FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\HOME-MASTER-PHP.htm', _
'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline&'\index.htm',8)
sleep(5000)
For $i = 1 To $sTotalFiles
   FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\PAGE-MASTER-PHP.htm', _
            'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline& '\index' & $i & '.htm',8)
        Next

Func _GetFileCount($Directory)
    Local $sTotalFiles = 0

    $search = FileFindFirstFile($Directory&"*.*")
    If $search = -1 Then
        MsgBox(0, "Error", "No files/directories matched the search pattern")
        Exit
    EndIf

    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
        $attrib = FileGetAttrib($Directory&$file)
        If StringInStr($attrib,"D") < 1 Then
            $sTotalFiles = $sTotalFiles+1
        EndIf
    WEnd

    FileClose($search)
    Return $sTotalFiles
EndFunc
Edited by styles3000

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.