Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 9:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Deleting text in txt
PostPosted: October 9th, 2018, 12:54 pm 
Offline

Joined: May 28th, 2007, 12:30 pm
Posts: 13
I have a txt file that has names of people. How to create a button that always deletes the first line?


For this message vgxbox has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Deleting text in txt
PostPosted: October 10th, 2018, 8:44 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
The following script will do it:

Code:
var myFilePath = "b:\\names.txt"

var myTextFileObject = OpenFile(myFilePath);

var myNames= new Array();

var i = 0;

while (myTextFileObject.EndOfFile() == false) {
   myNames[i] = myTextFileObject.ReadLine();
   i++;
}

myTextFileObject.Close();
var myTextFileObject = OpenFile(myFilePath,true);

for (i = 1; i < myNames.length; i++) {
   myTextFileObject.WriteLine(myNames[i]);
}

myTextFileObject.Close();

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : vgxbox


Top
 Profile Visit website  
 
 Post subject: Re: Deleting text in txt
PostPosted: October 10th, 2018, 11:34 pm 
Offline

Joined: May 28th, 2007, 12:30 pm
Posts: 13
Thanks ever so much


For this message vgxbox has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group