Dwayne,
Also you need to clear out the tHobbies and tPets variables, or the items will get added to with every repeat.
i.e. after the "set itemDel to TAB" line you could put
put "" into tHobbies put "" into tPets
Pat
----- Original Message ----- From: "Pat Trendler" <[EMAIL PROTECTED]>
To: "How to use Revolution" <[email protected]>
Sent: Saturday, February 05, 2005 3:22 PM
Subject: Re: Exporting multiple files#1
Hello Dwayne,
The item delimiter is still set to TAB - set it back to "|" before the last "end repeat" line.
Regards
Pat [EMAIL PROTECTED]
----- Original Message ----- From: "Dwayne Rothe" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, February 05, 2005 1:12 PM
Subject: Exporting multiple files#1
Hi All, I need help writing multiple files from a list! I have a text file with items delimited by "|" Amongst those items I have have more data delimited by TAB
eg. Name|Age|Favorite Color|Hobby1 Hobby2 Hobby3|Pet1 Pet2 Pet3
the fourth & fifth items may contain hobbies & pets which could be of any quantity!
What I am trying to do is write a seperate .txt file for each line, saved as the first
item as the file name.
e.g Say I have two lines as follows
John Doe|16|Blue|Fishing Cars Computers|Dog Cat Bird Jane Doe|14|Pink|Shopping Boys|Canary Goldfish
I want to save file as below;
Text file 1: ------------ Name: John Doe
Age: 16
Favorite Color: Blue
Hobbies:Fishing, Cars, Computers
Pets:Dog, Cat, Bird
saved as John Doe.txt
Text file 2: ------------ Name: Jane Doe
Age: 14
Favorite Color: Pink
Hobbies:Shopping, Boys
Pets:Canary, Goldfish
saved as Jane Doe.txt ------------------------------------------------------------------------- Here is the code I have so far that doesnt work properly!
put "John Doe" & cr & "Jane Doe" into tNames
put URL ("file:" & list.txt) into tList set itemDel to "|"
repeat for each line x in tNames put x into tName
get lineOffset(tName, tList) put line it of tList into tListData put item 1 of tListData into tName put item 2 of tListData into tAge put item 3 of tListData into tColor put item 4 of tListData into tHobby put item 5 of tListData into tPet
set itemDel to TAB repeat for each line x in tHobby put x & comma & space after tHobbies end repeat
repeat for each line x in tPet put x & comma & space after tPets end repeat
Put "Name:" && tName & cr & cr into tDataFile Put "Age:" && tAge & cr & cr after tDataFile Put "Favorite Color:" && tColor & cr & cr after tDataFile Put "Hobbies:" && tHobbies & cr & cr after tDataFile Put "Pets:" && tPets & cr & cr after tDataFile
put tDataFile into URL ("file:" & tName & ".txt") end repeat
This writes only one file!
Any help would be great!!! Thanx D.Rothe
_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
