Jump to content
Sign in to follow this  
zxzxzx

Replace this string ?

Recommended Posts

zxzxzx
Andreik

If the links is in a file (Ex:DOC.txt)

#include <File.au3>

$FILE = FileOpen(@ScriptDir & "\DOC.TXT",0)
For $INDEX = 1 To _FileCountLines(@ScriptDir & "\DOC.TXT")
    $DATA = FileReadLine($FILE,$INDEX)
    $NAME = StringSplit($DATA,",")
    MsgBox(0,$INDEX,$NAME[2])
Next
FileClose($FILE)

When the words fail... music speaks

Share this post


Link to post
Share on other sites
SmOke_N

zxzxzx

Try this:

$ReadFile = FileRead("c:\url.txt")

$aStrings = StringSplit($ReadFile, @CR & @LF, 1)

$hFile = FileOpen("c:\url.txt", 2)

For $i = 1 To $aStrings[0]
    FileWriteLine($hFile, StringRegExpReplace($aStrings[$i], "^\d*,", ""))
Next

FileClose($hFile)oÝ÷ Ûú®¢×ßÙ¢Þ²Çʮ׫²Ú(vØZ´-j·jØ­~ÚÂ¥zÚòx- Ú0¶­Ê·ö÷°®+mz{aj×(.׫²Ö§u»­Ê¢é]v­Â+a¢ëZ)jëh×6Local $s_write = StringRegExpReplace(FileRead("c:\url.txt"), "(^|\n)(\d*,)", "\1")
FileClose(FileOpen("c:\url.txt", 2))
FileWrite("c:\url.txt", $s_write)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
rasim

SmOke_N

Great! Thank you for nice example! Posted Image

Share this post


Link to post
Share on other sites
weaponx

Probably wiser NOT to string split on comma since I believe commas are valid url characters.

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  

×