Jump to content

Search the Community

Showing results for tags '_ReplaceStringInFile'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi, i wrote a script that can replace multiple strings in a xml file works fine but so slow! I've used StringReplace ,_ReplaceStringInFile, StringRegExpReplace, all the same very slow,. The number of replacements in the file about 8000 Any help would be greatly appreciated #include <File.au3> $path = @ScriptDir & '\xmlfo.xml' $OXML = FileOpen($path, 256) $XML = FileRead($OXML) $term = 'post' $nofr = 1 Local $aArray = StringRegExp($XML, '(?s)<entry[^>]*>.*?</entry>', 3) FileClose($OXML) $XL = $XML If Not @error Then For $i = 0 To UBound($aArray) - 1 ;get data start ;ConsoleWrite ( $aArray[0] &' '&$i& @CRLF) $date = StringRegExp($aArray[$i], '(?i)<published>(.*?)</published>', 3) If @error Then $date = StringRegExp("date err", "(.{33,}?(?:\s)|.+)", 3) ElseIf Not @error Then ;ConsoleWrite($date[0] & ' ' & $i & @CRLF) EndIf $kind = StringRegExp($aArray[$i], '(?i)<category>(.*?)</category>', 3) If @error Then $kind = StringRegExp("kind err", "(.{33,}?(?:\s)|.+)", 3) ;ConsoleWrite ( $kind[0] &' '&$i& @CRLF) ElseIf Not @error Then ;ConsoleWrite ( $kind[0] &' '&$i& @CRLF) EndIf If $kind[0] = $term And Data(getdate($date[0], 'year'), getdate($date[0], 'month')) = True Then _ReplaceStringInFile($path, $aArray[$i], '') If Not @error Then ;MsgBox(16,'',$XL) ConsoleWrite($nofr & ' ' & $i & @CRLF) $nofr = $nofr + 1 EndIf ;FileDelete(@ScriptDir & '\XML_output.xml') ;FileWrite (@ScriptDir & '\XML_output.xml', StringToBinary ( StringReplace($temp, $aArray[$i], "") , 4) ) Else ConsoleWrite ('err0x0'& @CRLF) EndIf Next EndIf
×
×
  • Create New...