Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

text file nightmare

 
Goto page 1, 2, 3
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  mac os x authentication on pdc samba  
Author Message
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 1) Posted: Thu Jan 24, 2008 3:40 am
Post subject: text file nightmare
Archived from groups: alt>comp>lang>applescript (more info?)

Hi there,
I don't want to get into the details but I am a DJ and I have a 2000
song music collection collected over years. Now, I moved my music onto
a different hard drive and my music programs will not find the files
any longer. I have to reimport the files and I need a script to find
values in one text document and to replace them with values from a
second document. If I cannot manage then years of my work will be
lost. The text files are in block like this:
<ENTRY ARTIST="Afro Celt Sound System"
AUDIO_ID="AfUAERERERERERERERIhEiESERERIiISIiIiIiIiIiIzMzMzNEREREQzRERENEMzNURURFMzRFRVVVZVREVUNERENERDRERENmQiJEMiKEMiR1QjR0MzSFM0V0IjaGVDd1VEd2VEh1RVd2dlmGdViHh2p2dX3t3LzLu77MzL7My77e7d/
+/t/+///t7uyXZYhVVpqIdWZXd77N3+y7u/
7f7fy6qsmGiLmHmbqXmaiHmcqHismXmrqYmqmqq5ZESGRFWZZEQyEQKKrbrLnKnLrbrKrare3tzdvMvdvdvczcvd3szt3dzc3c3bzM3c3c3M3N3d7d7M3MtmdSEREAAAAA"
TITLE="Saor/Free/News from Nowhere" TYPE="1">
<LOCATION DIR="/Users/kurtp/Music/iTunes/iTunes Music/Afro Celt
Sound System/Sound Magic, Vol. 1/" FILE="Saor_Free_News from
Nowhere.mp3" VOLUME="Disk"/>
<ALBUM TITLE="Sound Magic, Vol. 1" TRACK="1"/>
<INFO BITRATE="160000" FILESIZE="9836" GENRE="World"
IMPORT_DATE="2007/3/2" LABEL="6 slowdonwn" LAST_PLAYED="2007/9/21"
PLAYCOUNT="5" PLAYTIME="501" RANKING="153" RELEASE_DATE="1996/1/1"/>
<TEMPO BPM="163.944778" BPM_QUALITY="26.466862"/>
<LOUDNESS PEAK_DB="-0.799558" PERCEIVED_DB=" 2.399466"/>
<EXTDATA/>
</ENTRY>

I have 2000 songs so each text document will have 2000 such
paragraphs. So essentially the script has to search for values in
2000 of these paragraphs and it has to do it 2000 times so the script
will have to run through the second document 40000000 times. It's okay
as long as it does not take several days. Here is how it should work:
1) find text <entry artist
2) copy the text on the same line and to the right of <entry artist
as text as value 1
3) find text: <album title
4) copy the text on the same line and to the right of <album title as
text as value 2
5)find text FILE=
6) copy the text on the same line and to the right of FILE= as text
as value 3

find the paragraph with the same values in document 2 (that's the old
file which I cannot use anymore because the paths are incorrect. I
cannot edit the paths since iTunes has renamed some of the files too)
find value PLAYCOUNT=x(variable. whatever it says) in document 2 (in
that paragraph)
go back to document 1 and replace the value x with value x from
document 2
do the same thing with the value LAST_PLAYED=

go to paragraph 2 of document 2 (the next song) and repeat all over

Is this insane? Maybe there is a much easier way. As described, the
script needs so match songs and replace some information in the "song
paragraph" of document 1 from document 2.

I would love to get some feedback if this is doable and at what price.

Thank you very much. Karo

 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 2) Posted: Fri Jan 25, 2008 8:35 pm
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I got the first part. I managed for the script to identify paragraphs
and to correctly locate the information that need to be changed.
However, I am already stumped. Why doesn't this work:
set text item 3 of g to "aaaa"
Why cant i set a text item to whatever I want?

Thank you
Karo

tell application "TextEdit"
set allText to text of document 1
get document 1
end tell

set text item delimiters to ","

set f to text item 3 of allText
set text item delimiters to " "
set g to text item 4 of f
set text item delimiters to " "
set text item 3 of g to "aaaa"

 >> Stay informed about: text file nightmare 
Back to top
Login to vote
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 6253



(Msg. 3) Posted: Fri Jan 25, 2008 11:54 pm
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
Joseph.B

External


Since: Jan 26, 2008
Posts: 7



(Msg. 4) Posted: Sat Jan 26, 2008 10:21 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
Kurt

External


Since: May 02, 2005
Posts: 4



(Msg. 5) Posted: Sat Jan 26, 2008 2:12 pm
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

<biz.DeleteThis@theplayspace.com.au> wrote:

> Hi there,
> I don't want to get into the details but I am a DJ and I have a 2000
> song music collection collected over years. Now, I moved my music onto
> a different hard drive and my music programs will not find the files
> any longer. I have to reimport the files and I need a script to find
> values in one text document and to replace them with values from a
> second document. If I cannot manage then years of my work will be
> lost. The text files are in block like this:
> <ENTRY ARTIST="Afro Celt Sound System"
>....
> </ENTRY>

Looks like a xml file

>
> ......
> Is this insane? Maybe there is a much easier way. As described, the
> script needs so match songs and replace some information in the "song
> paragraph" of document 1 from document 2.
>
> I would love to get some feedback if this is doable and at what price.
>
> Thank you very much. Karo

Hi Karo,
did you try to handle it the direct way (xml-way) ?.
Have a look at the satimage-software site.
There's a xml.osax for free and some info and docs how to use.
<http://www.satimage.fr/software/en/downloads/downloads_companion_osaxen
..html>
<http://www.satimage.fr/software/en/smile/xml/index.html>

Kurt
--
if you want send me your info:
k dot klamp at t-online dot de
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
Simon Slavin1

External


Since: May 16, 2004
Posts: 625



(Msg. 6) Posted: Sat Jan 26, 2008 8:09 pm
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 24/01/2008, biz.RemoveThis@theplayspace.com.au wrote in message <0a87f498-ddc2-
45be-aee0-f2341fdf81ea.RemoveThis@j20g2000hsi.googlegroups.com>:

> I have 2000 songs so each text document will have 2000 such
> paragraphs. So essentially the script has to search for values in
> 2000 of these paragraphs and it has to do it 2000 times so the script
> will have to run through the second document 40000000 times.

Can you explain again what files the material to be search is in ? Is it
one big file containing details about all 2000 songs, or is it 2000
separate text files containing details on one song ?

In either case, can you give an idea of how many bytes, in total you need
to search ? if it's one file, what's the length of the file ? If it's
2000 files, what's the total filesize (e.g. if they're all in one folder,
go a 'Get Info' on the folder) ?

Your example 'ENTRY' block in XML format is only 1K in length. That means
that the material for all 2000 songs would only take up 2Meg. You can
easily read 2Meg into memory at the beginning of your application and do
all the searching in memory. That would be far faster than doing your
searching by searching disk files.

Simon.
--
http://www.hearsay.demon.co.uk
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 7) Posted: Sun Jan 27, 2008 3:22 pm
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 27, 8:10 am, Simon Slavin
<slavins.delete.these.four.wo....DeleteThis@hearsay.demon.co.uk> wrote:
> On 24/01/2008, b....DeleteThis@theplayspace.com.au wrote in message <0a87f498-ddc2-
>
> 45be-aee0-f2341fdf8....DeleteThis@j20g2000hsi.googlegroups.com>:
>
> > I have 2000 songs so each text document will have 2000 such
> > paragraphs. So essentially the script has to search for  values in
> > 2000 of these paragraphs and it has to do it 2000 times so the script
> > will have to run through the second document 40000000 times.
>
> Can you explain again what files the material to be search is in ?  Is it
> one big file containing details about all 2000 songs, or is it 2000
> separate text files containing details on one song ?
>
> In either case, can you give an idea of how many bytes, in total you need
> to search ?  if it's one file, what's the length of the file ?  If it's
> 2000 files, what's the total filesize (e.g. if they're all in one folder,
> go a 'Get Info' on the folder) ?
>
> Your example 'ENTRY' block in XML format is only 1K in length.  That means
> that the material for all 2000 songs would only take up 2Meg.  You can
> easily read 2Meg into memory at the beginning of your application and do
> all the searching in memory.  That would be far faster than doing your
> searching by searching disk files.
>
> Simon.
> --http://www.hearsay.demon.co.uk

Hi everyone. Thank you so much for your input. I got closer to my goal
and I will post what I already have very soon. The file is one file
with 2000 paragraphs. Each paragraph describes a song. The entire
document is 1.7MB large. Here is what I am working on now:
1) identify the first paragraph (song)
2) identify the following values: file name, song name, artist name,
path
3) tell iTunes to identify the first song by matching song name,
artist name (if exists) and file name (tricky because iTunes changed
some file names. The file name in the text document is contained in
the file name that iTunes has)
4) get the path name of the file
5) replace the path name of the text document with the path name from
iTunes. (and replace the ":" with "/" since iTunes path looks like
this "Disk:Users:kent"
6) go to next paragraph (song) and repeat everything.
I got most of the script done and like I said, will post it a bit
later.
Again, thank you everyone for your help. Karo
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 8) Posted: Mon Jan 28, 2008 12:29 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 28, 10:22 am, b... RemoveThis @theplayspace.com.au wrote:
> On Jan 27, 8:10 am, Simon Slavin
>
>
>
> <slavins.delete.these.four.wo... RemoveThis @hearsay.demon.co.uk> wrote:
> > On 24/01/2008, b... RemoveThis @theplayspace.com.au wrote in message <0a87f498-ddc2-
>
> > 45be-aee0-f2341fdf8... RemoveThis @j20g2000hsi.googlegroups.com>:
>
> > > I have 2000 songs so each text document will have 2000 such
> > > paragraphs. So essentially the script has to search for  values in
> > > 2000 of these paragraphs and it has to do it 2000 times so the script
> > > will have to run through the second document 40000000 times.
>
> > Can you explain again what files the material to be search is in ?  Is it
> > one big file containing details about all 2000 songs, or is it 2000
> > separate text files containing details on one song ?
>
> > In either case, can you give an idea of how many bytes, in total you need
> > to search ?  if it's one file, what's the length of the file ?  If it's
> > 2000 files, what's the total filesize (e.g. if they're all in one folder,
> > go a 'Get Info' on the folder) ?
>
> > Your example 'ENTRY' block in XML format is only 1K in length.  That means
> > that the material for all 2000 songs would only take up 2Meg.  You can
> > easily read 2Meg into memory at the beginning of your application and do
> > all the searching in memory.  That would be far faster than doing your
> > searching by searching disk files.
>
> > Simon.
> > --http://www.hearsay.demon.co.uk
>
> Hi everyone. Thank you so much for your input. I got closer to my goal
> and I will post what I already have very soon. The file is one file
> with 2000 paragraphs. Each paragraph describes a song. The entire
> document is 1.7MB large. Here is what I am working on now:
> 1) identify the first paragraph (song)
> 2) identify the following values: file name, song name, artist name,
> path
> 3) tell iTunes to identify the first song by matching song name,
> artist name (if exists) and file name (tricky because iTunes changed
> some file names. The file name in the text document is contained in
> the file name that iTunes has)
> 4) get the path name of the file
> 5) replace the path name of the text document with the path name from
> iTunes. (and replace the ":" with "/" since iTunes path looks like
> this "Disk:Users:kent"
> 6) go to next paragraph (song) and repeat everything.
> I got most of the script done and like I said, will post it a bit
> later.
> Again, thank you everyone for your help. Karo

okay, here is what I got:
The first part goes to the text file and gets the match criteria and
text that needs to be changed:
tell application "TextEdit"
set allText to text of document 1
end tell

set AppleScript's text item delimiters to "<ENTRY"
set parag to text item 2 of allText

set text item delimiters to "\""
set artistName to text item 2 of parag --First match criteria
set songName to text item 6 of parag --Second match criteria

set text item delimiters to " "

set line2 to text item 2 of parag
set text item delimiters to "\""
set filePath to text item 2 of line2 ----that's what needs to be
changed
set fileName to text item 4 of line2 --that's what also needs to be
changed


The second part is for iTunes to find the songs and get's the path and
prepares it for input into the text document:

tell application "iTunes"

--get name of current track
-- set x to track tracks of (view of front window) whose name is
"Staccato - Prince - girl - funky"
--set x to track 1 of library playlist 1 whose name is "Cry Freedom"
and the album is "Crash"
set TheTrack to track 1 of library playlist 1 whose artist is
artistName and the name is songName
set TheLocation to location of TheTrack as string
set TheLocationText to text of TheLocation
--then I need to replace the ":" with "/" because that's how my DJ
program describes paths
set text ":" of TheLocationText to "/"" this does not work
then I need to separate the file name from the rest of the path so my
DJ text file can use it

Then these 2 values need to replace filePath and fileName of the text
document.

I realize that this is getting a bit complex but I think I'm still
better off than changing 2000 songs one by one.
Thank you very much. karo
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
Joseph.B

External


Since: Jan 26, 2008
Posts: 7



(Msg. 9) Posted: Mon Jan 28, 2008 5:15 pm
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 10) Posted: Tue Jan 29, 2008 2:37 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 29, 8:05 am, j... DeleteThis @pas.ici (Joseph.B) wrote:
> <b... DeleteThis @theplayspace.com.au> wrote:
> >       --then I need to replace the ":" with "/" because that's how my DJ
> > program describes paths
> >  set text ":" of TheLocationText to "/"" this does not work
>
> I'm not sure it is what you are expecting, but
> this a little function wich changes all path delimiters on one command
>
> if the "old path" is
> myHD:Folder1:Folder2:Folder3:myFile
>
> the new will be
> myHD/Folder1/Folder2/Folder3/myFile
>
> ******
> set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> set newPath to Replace(":", "/", oldPath) of me -- *1
>
> on Replace(ChangeThis, byThis, inTheString)
>         set text item delimiters to ChangeThis
>         log text item delimiters -- for debugging only
>         set tempList to every text item of inTheString
>         log tempList  -- for debugging only
>         set text item delimiters to byThis
>         set newtext to ("" & tempList) as text
>         set text item delimiters to "" -- to reset TID
>         return newtext
> end Replace
> *******
>
> *1 the "of me" is requested to make sure that the hanler in wich the
> call is nested will search the function further in the whole script.
>
> Note that you can call and use this function for any purpose of same
> kind, all along your script, just change the parameters
> example :
>
> we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> this call:
> set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> Take care that upper and lower case match when passing params!
> Replace("folder", "iTuneFldr", oldPath) doesn't work.
> --
> J.B.

On Jan 29, 8:05 am, j... DeleteThis @pas.ici (Joseph.B) wrote:
> <b... DeleteThis @theplayspace.com.au> wrote:
> > --then I need to replace the ":" with "/" because that's how my DJ
> > program describes paths
> > set text ":" of TheLocationText to "/"" this does not work
>
> I'm not sure it is what you are expecting, but
> this a little function wich changes all path delimiters on one command
>
> if the "old path" is
> myHD:Folder1:Folder2:Folder3:myFile
>
> the new will be
> myHD/Folder1/Folder2/Folder3/myFile
>
> ******
> set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> set newPath to Replace(":", "/", oldPath) of me -- *1
>
> on Replace(ChangeThis, byThis, inTheString)
> set text item delimiters to ChangeThis
> log text item delimiters -- for debugging only
> set tempList to every text item of inTheString
> log tempList -- for debugging only
> set text item delimiters to byThis
> set newtext to ("" & tempList) as text
> set text item delimiters to "" -- to reset TID
> return newtext
> end Replace
> *******
>
> *1 the "of me" is requested to make sure that the hanler in wich the
> call is nested will search the function further in the whole script.
>
> Note that you can call and use this function for any purpose of same
> kind, all along your script, just change the parameters
> example :
>
> we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> this call:
> set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> Take care that upper and lower case match when passing params!
> Replace("folder", "iTuneFldr", oldPath) doesn't work.
> --
> J.B.

Thanks Joseph. That worked great. I had to fiddle with it a bit to get
it into exactly the right format (like what's in the text file). So
what's next? I have the text that needs to be changed in the text file
and I have the 2 variables to replace them. How should I go about it?
I am getting excited because it looks like I am close! Thank you,
thank you!

part1:
tell application "TextEdit"
set allText to text of document 1
end tell

set AppleScript's text item delimiters to "<ENTRY"
set parag to text item 2 of allText

set text item delimiters to "\""
set artistName to text item 2 of parag --First match criteria
set songName to text item 6 of parag --Second match criteria

set text item delimiters to " "

set line2 to text item 2 of parag
set text item delimiters to "\""
set filePath to text item 2 of line2 ----that's what needs to be
replaced with value of filePath2
set fileName to text item 4 of line2 --that's what also needs to be
replaced with value of fileName2

part 2:


tell application "iTunes"

set TheTrack to track 1 of library playlist 1 whose artist is
"Jupiter Ace" and the name is "1000 years"
set TheLocation to location of TheTrack as string
set TheLocationText to text of TheLocation
end tell

set oldPath to TheLocationText
set newPath to replace(":", "/", oldPath) of me -- *1
on replace(ChangeThis, byThis, inTheString)
set text item delimiters to ChangeThis
log text item delimiters -- for debugging only
set tempList to every text item of inTheString
log tempList -- for debugging only
set text item delimiters to byThis
set newText to ("" & tempList) as text
set text item delimiters to "/" -- to reset TID
set fileName2 to text item -1 of newText -- my varible that needs to
replace variable fileName
set filePat2 to text items 2 through -2 of newText as text
set filePath2 to "/" & filePat2 & "/" -- my varible that needs to
replace variable filePath

end replace
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 11) Posted: Tue Jan 29, 2008 6:11 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 29, 9:37 pm, b....DeleteThis@theplayspace.com.au wrote:
> On Jan 29, 8:05 am, j....DeleteThis@pas.ici (Joseph.B) wrote:
>
>
>
> > <b....DeleteThis@theplayspace.com.au> wrote:
> > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > program describes paths
> > >  set text ":" of TheLocationText to "/"" this does not work
>
> > I'm not sure it is what you are expecting, but
> > this a little function wich changes all path delimiters on one command
>
> > if the "old path" is
> > myHD:Folder1:Folder2:Folder3:myFile
>
> > the new will be
> > myHD/Folder1/Folder2/Folder3/myFile
>
> > ******
> > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > on Replace(ChangeThis, byThis, inTheString)
> >         set text item delimiters to ChangeThis
> >         log text item delimiters -- for debugging only
> >         set tempList to every text item of inTheString
> >         log tempList  -- for debugging only
> >         set text item delimiters to byThis
> >         set newtext to ("" & tempList) as text
> >         set text item delimiters to "" -- to reset TID
> >         return newtext
> > end Replace
> > *******
>
> > *1 the "of me" is requested to make sure that the hanler in wich the
> > call is nested will search the function further in the whole script.
>
> > Note that you can call and use this function for any purpose of same
> > kind, all along your script, just change the parameters
> > example :
>
> > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> > this call:
> > set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> > gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> > Take care that upper and lower case match when passing params!
> > Replace("folder", "iTuneFldr", oldPath) doesn't work.
> > --
> > J.B.
>
> On Jan 29, 8:05 am, j....DeleteThis@pas.ici (Joseph.B) wrote:
>
>
>
> > <b....DeleteThis@theplayspace.com.au> wrote:
> > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > program describes paths
> > >  set text ":" of TheLocationText to "/"" this does not work
>
> > I'm not sure it is what you are expecting, but
> > this a little function wich changes all path delimiters on one command
>
> > if the "old path" is
> > myHD:Folder1:Folder2:Folder3:myFile
>
> > the new will be
> > myHD/Folder1/Folder2/Folder3/myFile
>
> > ******
> > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > on Replace(ChangeThis, byThis, inTheString)
> >         set text item delimiters to ChangeThis
> >         log text item delimiters -- for debugging only
> >         set tempList to every text item of inTheString
> >         log tempList  -- for debugging only
> >         set text item delimiters to byThis
> >         set newtext to ("" & tempList) as text
> >         set text item delimiters to "" -- to reset TID
> >         return newtext
> > end Replace
> > *******
>
> > *1 the "of me" is requested to make sure that the hanler in wich the
> > call is nested will search the function further in the whole script.
>
> > Note that you can call and use this function for any purpose of same
> > kind, all along your script, just change the parameters
> > example :
>
> > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> > this call:
> > set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> > gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> > Take care that upper and lower case match when passing params!
> > Replace("folder", "iTuneFldr", oldPath) doesn't work.
> > --
> > J.B.
>
> Thanks Joseph. That worked great. I had to fiddle with it a bit to get
> it into exactly the right format (like what's in the text file). So
> what's next? I have the text that needs to be changed in the text file
> and I have the 2 variables to replace them. How should I go about it?
> I am getting excited because it looks like I am close! Thank you,
> thank you!
>
> part1:
> tell application "TextEdit"
>         set allText to text of document 1
> end tell
>
> set AppleScript's text item delimiters to "<ENTRY"
> set parag to text item 2 of allText
>
> set text item delimiters to "\""
> set artistName to text item 2 of parag --First match criteria
> set songName to text item 6 of parag --Second match criteria
>
> set text item delimiters to "    "
>
> set line2 to text item 2 of parag
> set text item delimiters to "\""
> set filePath to text item 2 of line2 ----that's what needs to be
> replaced with value of filePath2
> set fileName to text item 4 of line2 --that's what also needs to be
> replaced with value of fileName2
>
> part 2:
>
> tell application "iTunes"
>
>         set TheTrack to track 1 of library playlist 1 whose artist is
> "Jupiter Ace" and the name is "1000 years"
>         set TheLocation to location of TheTrack as string
>         set TheLocationText to text of TheLocation
> end tell
>
> set oldPath to TheLocationText
> set newPath to replace(":", "/", oldPath) of me -- *1
> on replace(ChangeThis, byThis, inTheString)
>         set text item delimiters to ChangeThis
>         log text item delimiters -- for debugging only
>         set tempList to every text item of inTheString
>         log tempList -- for debugging only
>         set text item delimiters to byThis
>         set newText to ("" & tempList) as text
>         set text item delimiters to "/" -- to reset TID
>         set fileName2 to text item -1 of newText -- my varible that needs to
> replace variable fileName
>         set filePat2 to text items 2 through -2 of newText as text
>         set filePath2 to "/" & filePat2 & "/" -- my varible that needs to
> replace variable filePath
>
> end replace

Just spent another 4.5 hours: I got it working: Hooray! I only have to
do one more thing: make the script skip to the next paragraph (parag)
and repeat. If artistName is missing then skip to the next paragraph.
Any help with how I could create such a repeat loop is much
appreciated. Karo
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 12) Posted: Tue Jan 29, 2008 6:48 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 30, 1:11 am, b... DeleteThis @theplayspace.com.au wrote:
> On Jan 29, 9:37 pm, b... DeleteThis @theplayspace.com.au wrote:
>
>
>
> > On Jan 29, 8:05 am, j... DeleteThis @pas.ici (Joseph.B) wrote:
>
> > > <b... DeleteThis @theplayspace.com.au> wrote:
> > > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > > program describes paths
> > > >  set text ":" of TheLocationText to "/"" this does not work
>
> > > I'm not sure it is what you are expecting, but
> > > this a little function wich changes all path delimiters on one command
>
> > > if the "old path" is
> > > myHD:Folder1:Folder2:Folder3:myFile
>
> > > the new will be
> > > myHD/Folder1/Folder2/Folder3/myFile
>
> > > ******
> > > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > > on Replace(ChangeThis, byThis, inTheString)
> > >         set text item delimiters to ChangeThis
> > >         log text item delimiters -- for debugging only
> > >         set tempList to every text item of inTheString
> > >         log tempList  -- for debugging only
> > >         set text item delimiters to byThis
> > >         set newtext to ("" & tempList) as text
> > >         set text item delimiters to "" -- to reset TID
> > >         return newtext
> > > end Replace
> > > *******
>
> > > *1 the "of me" is requested to make sure that the hanler in wich the
> > > call is nested will search the function further in the whole script.
>
> > > Note that you can call and use this function for any purpose of same
> > > kind, all along your script, just change the parameters
> > > example :
>
> > > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> > > this call:
> > > set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> > > gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> > > Take care that upper and lower case match when passing params!
> > > Replace("folder", "iTuneFldr", oldPath) doesn't work.
> > > --
> > > J.B.
>
> > On Jan 29, 8:05 am, j... DeleteThis @pas.ici (Joseph.B) wrote:
>
> > > <b... DeleteThis @theplayspace.com.au> wrote:
> > > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > > program describes paths
> > > >  set text ":" of TheLocationText to "/"" this does not work
>
> > > I'm not sure it is what you are expecting, but
> > > this a little function wich changes all path delimiters on one command
>
> > > if the "old path" is
> > > myHD:Folder1:Folder2:Folder3:myFile
>
> > > the new will be
> > > myHD/Folder1/Folder2/Folder3/myFile
>
> > > ******
> > > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > > on Replace(ChangeThis, byThis, inTheString)
> > >         set text item delimiters to ChangeThis
> > >         log text item delimiters -- for debugging only
> > >         set tempList to every text item of inTheString
> > >         log tempList  -- for debugging only
> > >         set text item delimiters to byThis
> > >         set newtext to ("" & tempList) as text
> > >         set text item delimiters to "" -- to reset TID
> > >         return newtext
> > > end Replace
> > > *******
>
> > > *1 the "of me" is requested to make sure that the hanler in wich the
> > > call is nested will search the function further in the whole script.
>
> > > Note that you can call and use this function for any purpose of same
> > > kind, all along your script, just change the parameters
> > > example :
>
> > > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> > > this call:
> > > set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> > > gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> > > Take care that upper and lower case match when passing params!
> > > Replace("folder", "iTuneFldr", oldPath) doesn't work.
> > > --
> > > J.B.
>
> > Thanks Joseph. That worked great. I had to fiddle with it a bit to get
> > it into exactly the right format (like what's in the text file). So
> > what's next? I have the text that needs to be changed in the text file
> > and I have the 2 variables to replace them. How should I go about it?
> > I am getting excited because it looks like I am close! Thank you,
> > thank you!
>
> > part1:
> > tell application "TextEdit"
> >         set allText to text of document 1
> > end tell
>
> > set AppleScript's text item delimiters to "<ENTRY"
> > set parag to text item 2 of allText
>
> > set text item delimiters to "\""
> > set artistName to text item 2 of parag --First match criteria
> > set songName to text item 6 of parag --Second match criteria
>
> > set text item delimiters to "    "
>
> > set line2 to text item 2 of parag
> > set text item delimiters to "\""
> > set filePath to text item 2 of line2 ----that's what needs to be
> > replaced with value of filePath2
> > set fileName to text item 4 of line2 --that's what also needs to be
> > replaced with value of fileName2
>
> > part 2:
>
> > tell application "iTunes"
>
> >         set TheTrack to track 1 of library playlist 1 whose artist is
> > "Jupiter Ace" and the name is "1000 years"
> >         set TheLocation to location of TheTrack as string
> >         set TheLocationText to text of TheLocation
> > end tell
>
> > set oldPath to TheLocationText
> > set newPath to replace(":", "/", oldPath) of me -- *1
> > on replace(ChangeThis, byThis, inTheString)
> >         set text item delimiters to ChangeThis
> >         log text item delimiters -- for debugging only
> >         set tempList to every text item of inTheString
> >         log tempList -- for debugging only
> >         set text item delimiters to byThis
> >         set newText to ("" & tempList) as text
> >         set text item delimiters to "/" -- to reset TID
> >         set fileName2 to text item -1 of newText -- my varible that needs to
> > replace variable fileName
> >         set filePat2 to text items 2 through -2 of newText as text
> >         set filePath2 to "/" & filePat2 & "/" -- my varible that needs to
> > replace variable filePath
>
> > end replace
>
> Just spent another 4.5 hours: I got it working: Hooray! I only have to
> do one more thing: make the script skip to the next paragraph (parag)
> and repeat. If artistName is missing then skip to the next paragraph.
> Any help with how I could create such a repeat loop is much
> appreciated. Karo

Ok, I got it all working except the repeat function. Why cant I repeat
if there is an "on" function.

I want to say:
repeat 2000 times

code

end repeat.

It won't let me because of the on function. Here is my entire code
(except for skipping the empty artist field):

global allText
global filePath
global fileName
global artistName
global songName
global fileName2
global filePath2
global counter



set counter to 2
tell application "TextEdit"
set allText to text of document 1
set textItems to text items of allText


set AppleScript's text item delimiters to "<ENTRY"
set parag to text item counter of allText

set AppleScript's text item delimiters to "\""
set artistName to text item 2 of parag --First match criteria
set songName to text item 6 of parag --Second match criteria

set AppleScript's text item delimiters to " "

set line2 to text item 2 of parag
set AppleScript's text item delimiters to "\""
set filePath to text item 2 of line2 as text ----that's what needs to
be replaced with value of filePath2
set fileName to text item 4 of line2 as text --that's what also needs
to be replaced with value of fileName2
end tell

tell application "iTunes"

set TheTrack to track 1 of library playlist 1 whose artist is
artistName and the name is songName
set TheLocation to location of TheTrack as string
set TheLocationText to text of TheLocation
end tell

set oldPath to TheLocationText
set newPath to replace(":", "/", oldPath) of me -- *1
on replace(ChangeThis, byThis, inTheString)
set text item delimiters to ChangeThis
log text item delimiters -- for debugging only
set tempList to every text item of inTheString
log tempList -- for debugging only
set text item delimiters to byThis
set newText to ("" & tempList) as text
set text item delimiters to "/" -- to reset TID
set fileName2 to text item -1 of newText -- my varible that needs to
replace variable fileName
set filePat2 to text items 2 through -2 of newText as text
set filePath2 to "/" & filePat2 & "/" as text -- my varible that
needs to replace variable filePath


end replace


tell application "TextEdit"

set my text item delimiters to fileName -- define what you want to
find
set i to text items of allText -- find all the replacements
set my text item delimiters to fileName2 -- define what you want to
replace with
set destText to i as text -- make the switch
set text of document 1 to destText -- and write the data back

set my text item delimiters to filePath -- define what you want to
find
set i to text items of destText -- find all the replacements
set my text item delimiters to filePath2 -- define what you want to
replace with
set destText to i as text -- make the switch
set text of document 1 to destText -- and write the data bac


end tell
set counter to counter + 1
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 13) Posted: Tue Jan 29, 2008 7:15 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 30, 1:48 am, b....DeleteThis@theplayspace.com.au wrote:
> On Jan 30, 1:11 am, b....DeleteThis@theplayspace.com.au wrote:
>
>
>
> > On Jan 29, 9:37 pm, b....DeleteThis@theplayspace.com.au wrote:
>
> > > On Jan 29, 8:05 am, j....DeleteThis@pas.ici (Joseph.B) wrote:
>
> > > > <b....DeleteThis@theplayspace.com.au> wrote:
> > > > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > > > program describes paths
> > > > >  set text ":" of TheLocationText to "/"" this does not work
>
> > > > I'm not sure it is what you are expecting, but
> > > > this a little function wich changes all path delimiters on one command
>
> > > > if the "old path" is
> > > > myHD:Folder1:Folder2:Folder3:myFile
>
> > > > the new will be
> > > > myHD/Folder1/Folder2/Folder3/myFile
>
> > > > ******
> > > > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > > > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > > > on Replace(ChangeThis, byThis, inTheString)
> > > >         set text item delimiters to ChangeThis
> > > >         log text item delimiters -- for debugging only
> > > >         set tempList to every text item of inTheString
> > > >         log tempList  -- for debugging only
> > > >         set text item delimiters to byThis
> > > >         set newtext to ("" & tempList) as text
> > > >         set text item delimiters to "" -- to reset TID
> > > >         return newtext
> > > > end Replace
> > > > *******
>
> > > > *1 the "of me" is requested to make sure that the hanler in wich the
> > > > call is nested will search the function further in the whole script.
>
> > > > Note that you can call and use this function for any purpose of same
> > > > kind, all along your script, just change the parameters
> > > > example :
>
> > > > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> > > > this call:
> > > > set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> > > > gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> > > > Take care that upper and lower case match when passing params!
> > > > Replace("folder", "iTuneFldr", oldPath) doesn't work.
> > > > --
> > > > J.B.
>
> > > On Jan 29, 8:05 am, j....DeleteThis@pas.ici (Joseph.B) wrote:
>
> > > > <b....DeleteThis@theplayspace.com.au> wrote:
> > > > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > > > program describes paths
> > > > >  set text ":" of TheLocationText to "/"" this does not work
>
> > > > I'm not sure it is what you are expecting, but
> > > > this a little function wich changes all path delimiters on one command
>
> > > > if the "old path" is
> > > > myHD:Folder1:Folder2:Folder3:myFile
>
> > > > the new will be
> > > > myHD/Folder1/Folder2/Folder3/myFile
>
> > > > ******
> > > > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > > > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > > > on Replace(ChangeThis, byThis, inTheString)
> > > >         set text item delimiters to ChangeThis
> > > >         log text item delimiters -- for debugging only
> > > >         set tempList to every text item of inTheString
> > > >         log tempList  -- for debugging only
> > > >         set text item delimiters to byThis
> > > >         set newtext to ("" & tempList) as text
> > > >         set text item delimiters to "" -- to reset TID
> > > >         return newtext
> > > > end Replace
> > > > *******
>
> > > > *1 the "of me" is requested to make sure that the hanler in wich the
> > > > call is nested will search the function further in the whole script.
>
> > > > Note that you can call and use this function for any purpose of same
> > > > kind, all along your script, just change the parameters
> > > > example :
>
> > > > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>
> > > > this call:
> > > > set finalPath to Replace("Folder", "iTuneFldr", newPath) of me
>
> > > > gives finalPath = "myHD/iTuneFldr1/iTuneFldr2/iTuneFldr3/myFile"
>
> > > > Take care that upper and lower case match when passing params!
> > > > Replace("folder", "iTuneFldr", oldPath) doesn't work.
> > > > --
> > > > J.B.
>
> > > Thanks Joseph. That worked great. I had to fiddle with it a bit to get
> > > it into exactly the right format (like what's in the text file). So
> > > what's next? I have the text that needs to be changed in the text file
> > > and I have the 2 variables to replace them. How should I go about it?
> > > I am getting excited because it looks like I am close! Thank you,
> > > thank you!
>
> > > part1:
> > > tell application "TextEdit"
> > >         set allText to text of document 1
> > > end tell
>
> > > set AppleScript's text item delimiters to "<ENTRY"
> > > set parag to text item 2 of allText
>
> > > set text item delimiters to "\""
> > > set artistName to text item 2 of parag --First match criteria
> > > set songName to text item 6 of parag --Second match criteria
>
> > > set text item delimiters to "    "
>
> > > set line2 to text item 2 of parag
> > > set text item delimiters to "\""
> > > set filePath to text item 2 of line2 ----that's what needs to be
> > > replaced with value of filePath2
> > > set fileName to text item 4 of line2 --that's what also needs to be
> > > replaced with value of fileName2
>
> > > part 2:
>
> > > tell application "iTunes"
>
> > >         set TheTrack to track 1 of library playlist 1 whose artist is
> > > "Jupiter Ace" and the name is "1000 years"
> > >         set TheLocation to location of TheTrack as string
> > >         set TheLocationText to text of TheLocation
> > > end tell
>
> > > set oldPath to TheLocationText
> > > set newPath to replace(":", "/", oldPath) of me -- *1
> > > on replace(ChangeThis, byThis, inTheString)
> > >         set text item delimiters to ChangeThis
> > >         log text item delimiters -- for debugging only
> > >         set tempList to every text item of inTheString
> > >         log tempList -- for debugging only
> > >         set text item delimiters to byThis
> > >         set newText to ("" & tempList) as text
> > >         set text item delimiters to "/" -- to reset TID
> > >         set fileName2 to text item -1 of newText -- my varible that needs to
> > > replace variable fileName
> > >         set filePat2 to text items 2 through -2 of newText as text
> > >         set filePath2 to "/" & filePat2 & "/" -- my varible that needs to
> > > replace variable filePath
>
> > > end replace
>
> > Just spent another 4.5 hours: I got it working: Hooray! I only have to
> > do one more thing: make the script skip to the next paragraph (parag)
> > and repeat. If artistName is missing then skip to the next paragraph.
> > Any help with how I could create such a repeat loop is much
> > appreciated. Karo
>
> Ok, I got it all working except the repeat function. Why cant I repeat
> if there is an "on" function.
>
> I want to say:
> repeat 2000 times
>
> code
>
> end repeat.
>
> It won't let me because of the on function. Here is my entire code
> (except for skipping the empty artist field):
>
> global allText
> global filePath
> global fileName
> global artistName
> global songName
> global fileName2
> global filePath2
> global counter
>
> set counter to 2
> tell application "TextEdit"
>         set allText to text of document 1
>         set textItems to text items of allText
>
>         set AppleScript's text item delimiters to "<ENTRY"
>         set parag to text item counter of allText
>
>         set AppleScript's text item delimiters to "\""
>         set artistName to text item 2 of parag --First match criteria
>         set songName to text item 6 of parag --Second match criteria
>
>         set AppleScript's text item delimiters to "    "
>
>         set line2 to text item 2 of parag
>         set AppleScript's text item delimiters to "\""
>         set filePath to text item 2 of line2 as text ----that's what needs to
> be replaced with value of filePath2
>         set fileName to text item 4 of line2 as text --that's what also needs
> to be replaced with value of fileName2
> end tell
>
> tell application "iTunes"
>
>         set TheTrack to track 1 of library playlist 1 whose artist is
> artistName and the name is songName
>         set TheLocation to location of TheTrack as string
>         set TheLocationText to text of TheLocation
> end tell
>
> set oldPath to TheLocationText
> set newPath to replace(":", "/", oldPath) of me -- *1
> on replace(ChangeThis, byThis, inTheString)
>         set text item delimiters to ChangeThis
>         log text item delimiters -- for debugging only
>         set tempList to every text item of inTheString
>         log tempList -- for debugging only
>         set text item delimiters to byThis
>         set newText to ("" & tempList) as text
>         set text item delimiters to "/" -- to reset TID
>         set fileName2 to text item -1 of newText -- my varible that needs to
> replace variable fileName
>         set filePat2 to text items 2 through -2 of newText as text
>         set filePath2 to "/" & filePat2 & "/" as text -- my varible that
> needs to replace variable filePath
>
> end replace
>
> tell application "TextEdit"
>
>         set my text item delimiters to fileName -- define what you want to
> find
>         set i to text items of allText -- find all the replacements
>         set my text item delimiters to fileName2 -- define what you want to
> replace with
>         set destText to i as text -- make the switch
>         set text of document 1 to destText -- and write the data back
>
>         set my text item delimiters to filePath -- define what you want to
> find
>         set i to text items of destText -- find all the replacements
>         set my text item delimiters to filePath2 -- define what you want to
> replace with
>         set destText to i as text -- make the switch
>         set text of document 1 to destText -- and write the data bac
>
> end tell
> set counter to counter + 1

Sorry for posting so many postings. I am extremely close. There are
just 2 things that don't work: I can't repeat the script and I don't
know how to tell it to abandon the rest of the script and jump to
beginning of repeat loop if "ARTIST=" is not found. This is the last
of it. I very much appreciate your help. Karo. Here is the final
script:

global allText
global filePath
global fileName
global artistName
global songName
global fileName2
global filePath2
global counter



set counter to 2
--repeat 1892 times DOES NOT WORK
tell application "TextEdit"
set allText to text of document 1
set textItems to text items of allText


set AppleScript's text item delimiters to "<ENTRY"
set parag to text item counter of allText

set AppleScript's text item delimiters to "\""
if text item 2 of parag does not contain "ARTIST=" then
set counter to counter to counter + 1
--jump to the beginning of the repeat loop DOES NOT WORK
else
set parag to text item counter of allText
set artistName to text item 2 of parag --First match criteria
set songName to text item 6 of parag --Second match criteria

set AppleScript's text item delimiters to " "

set line2 to text item 2 of parag
set AppleScript's text item delimiters to "\""
set filePath to text item 2 of line2 as text ----that's what needs
to be replaced with value of filePath2
set fileName to text item 4 of line2 as text --that's what also
needs to be replaced with value of fileName2

end if
end tell

tell application "iTunes"

set TheTrack to track 1 of library playlist 1 whose artist is
artistName and the name is songName
set TheLocation to location of TheTrack as string
set TheLocationText to text of TheLocation
end tell

set oldPath to TheLocationText
set newPath to replace(":", "/", oldPath) of me -- *1
on replace(ChangeThis, byThis, inTheString)
set text item delimiters to ChangeThis
log text item delimiters -- for debugging only
set tempList to every text item of inTheString
log tempList -- for debugging only
set text item delimiters to byThis
set newText to ("" & tempList) as text
set text item delimiters to "/" -- to reset TID
set fileName2 to text item -1 of newText -- my varible that needs to
replace variable fileName
set filePat2 to text items 2 through -2 of newText as text
set filePath2 to "/" & filePat2 & "/" as text -- my varible that
needs to replace variable filePath


end replace


tell application "TextEdit"

set my text item delimiters to fileName -- define what you want to
find
set i to text items of allText -- find all the replacements
set my text item delimiters to fileName2 -- define what you want to
replace with
set destText to i as text -- make the switch
set text of document 1 to destText -- and write the data back

set my text item delimiters to filePath -- define what you want to
find
set i to text items of destText -- find all the replacements
set my text item delimiters to filePath2 -- define what you want to
replace with
set destText to i as text -- make the switch
set text of document 1 to destText -- and write the data bac

end tell
set counter to counter + 1

--end repeat DOES NOT WORK
 >> Stay informed about: text file nightmare 
Back to top
Login to vote
biz

External


Since: Dec 31, 2007
Posts: 25



(Msg. 14) Posted: Tue Jan 29, 2008 8:36 am
Post subject: Re: text file nightmare [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 30, 1:48 am, b... DeleteThis @theplayspace.com.au wrote:
> On Jan 30, 1:11 am, b... DeleteThis @theplayspace.com.au wrote:
>
>
>
> > On Jan 29, 9:37 pm, b... DeleteThis @theplayspace.com.au wrote:
>
> > > On Jan 29, 8:05 am, j... DeleteThis @pas.ici (Joseph.B) wrote:
>
> > > > <b... DeleteThis @theplayspace.com.au> wrote:
> > > > >       --then I need to replace the ":" with "/" because that's how my DJ
> > > > > program describes paths
> > > > >  set text ":" of TheLocationText to "/"" this does not work
>
> > > > I'm not sure it is what you are expecting, but
> > > > this a little function wich changes all path delimiters on one command
>
> > > > if the "old path" is
> > > > myHD:Folder1:Folder2:Folder3:myFile
>
> > > > the new will be
> > > > myHD/Folder1/Folder2/Folder3/myFile
>
> > > > ******
> > > > set oldPath to "myHD:Folder1:Folder2:Folder3:myFile"
> > > > set newPath to Replace(":", "/", oldPath) of me -- *1
>
> > > > on Replace(ChangeThis, byThis, inTheString)
> > > >         set text item delimiters to ChangeThis
> > > >         log text item delimiters -- for debugging only
> > > >         set tempList to every text item of inTheString
> > > >         log tempList  -- for debugging only
> > > >         set text item delimiters to byThis
> > > >         set newtext to ("" & tempList) as text
> > > >         set text item delimiters to "" -- to reset TID
> > > >         return newtext
> > > > end Replace
> > > > *******
>
> > > > *1 the "of me" is requested to make sure that the hanler in wich the
> > > > call is nested will search the function further in the whole script.
>
> > > > Note that you can call and use this function for any purpose of same
> > > > kind, all along your script, just change the parameters
> > > > example :
>
> > > > we assume that newPath is now "myHD/Folder1/Folder2/Folder3/myFile"
>