Sign in to follow this  
Followers 0
iceberg

Replace First Line

4 posts in this topic

#1 ·  Posted (edited)

Hi,

I know it is possible to replace a line in a text file. But how do I perform the following:

1) Hundreds of text files in a folder

2) Need a script to "open" up each of them so that the first line all those files can be modified.

Please help. Thanks.

Edited by iceberg

mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites



Hi,

I know it is possible to replace a line in a text file. But how do I perform the following:

1) Hundreds of text files in a folder

2) Need a script to "open" up each of them so that the first line all those files can be modified.

Please help. Thanks.

Look at FileFindFirstFile() and FileFindNextFile() in the Beta help file, then store them into an array, and perform what you want in order with a loop on each file with whatever method your using to replace the first line. Maybe even _FileWriteToLine() would help.

[center]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.[/center]

Share this post


Link to post
Share on other sites

thnaks for the reply SmOke_N.

i m very weak in arrays.

can someone be kind enuf to guide and start me off....?


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

With this little script you can see a list of your files.

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray('C:\Program Files', '*.*', 0) ;set your folder
_ArrayDisplay($FileList,'$FileList')oÝ÷ ØZ+Ê«)Êj{¬{tß¡bââ²Ý7õ«­¢+Ù5Í ½à À°Ìäí9յȽ¥±ÌÌäì°ÀÌØí¥±1¥ÍÑlÁt¤íÑÉäÀÌØí¥±1¥ÍÑlÅt°ÀÌØí¥±1¥ÍÑlÉtѸ

Look at helpfile (BETA I think) and you're surely be able to write this script on your own.

EDIT: added comments

Edited by Briegel

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  
Followers 0