Sign in to follow this  
Followers 0
akfourtyseven

Read from a text file?

6 posts in this topic

I want my script to read from .txt file or .ini and perform different actions on the items in the text file.

For example,

test.txt contains

C:\ak.txt

D:\b.txt

E:\c.txt,

I want my script to copy the file that's on the first line(i.e, C:\ak.txt), delete the file on the second line and move the file on the third line.

I was able to read from the text file but I only can perform one operation. Is there any way to do this?

Thanx in advance!


There are 10 kinds of people, those who understand me and those who don't.

Share this post


Link to post
Share on other sites



I want my script to read from .txt file or .ini and perform different actions on the items in the text file.

For example,

test.txt contains

C:\ak.txt

D:\b.txt

E:\c.txt,

I want my script to copy the file that's on the first line(i.e, C:\ak.txt), delete the file on the second line and move the file on the third line.

I was able to read from the text file but I only can perform one operation. Is there any way to do this?

Thanx in advance!

I am not sure I understand. Have you looked at?

FileCopy()oÝ÷ Ù«­¢+Ù¥±5½Ù ¤oÝ÷ Ù«­¢+Ù¥±I1¥¹ ¤

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

I am not sure I understand. Have you looked at?

FileCopy()ƒoÝŠ÷ Ù«­¢+Ù¥±•5½Ù” ¤ƒoÝŠ÷ Ù«­¢+Ù¥±•I•…‘1¥¹” ¤
What I need my script file to do is to perform different actions on the files that are in the test.txt file.

I want it to copy the file that is on the first line (C:\ak.txt)

Delete the file on the second line(D:\B.txt)

Move the file on the third line(E:\c.txt)

So if you write the path of your file on the first line, it will be copied and if you write the path of your file on the second line it will be deleted and so on.


There are 10 kinds of people, those who understand me and those who don't.

Share this post


Link to post
Share on other sites

Use this

For $i=1 to 500
$var=FileReadLine("x:\test.txt",$i)
If $var="" Then ExitLoop

If $i=1 Then FileCopy($var,"c:\temp\file.txt"); copies that file to temp folder
If $i=2 Then FileDelete($var); delete file on 2nd line
if $i=3 Then FileMove($var,"c:\temp\file.txt"); moves file on 3rd line

Next

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Use this

For $i=1 to 500
$var=FileReadLine("x:\test.txt",$i)
If $var="" Then ExitLoop

If $i=1 Then FileCopy($var,"c:\temp\file.txt"); copies that file to temp folder
If $i=2 Then FileDelete($var); delete file on 2nd line
if $i=3 Then FileMove($var,"c:\temp\file.txt"); moves file on 3rd line

Next
Thanx Manjish!

You're the man!

Edited by akfourtyseven

There are 10 kinds of people, those who understand me and those who don't.

Share this post


Link to post
Share on other sites

You are welcome


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

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