Scripting on the texttier


I am a very new user of Praat and I also am a very novice scripter, so
I have a few questions. (mainly I am scripting by taking the history
function and changing relevant things to variables)

I would like to be able to take a segmented tier in the text grid,
duplicate it and then cut specific segments of that tier into fourths
(or thirds or whatever) and relabel them.

1) is there a way to select a tier that is designated by a variable in
the text grid?
(i.e. I have a sound file that has been segmented within the texttier
for speaker, utterance, word... I'd like to select the word tier)

2) once selected, can a tier be duplicated?

3) is it possible to insert labels into the text tier using the
scripting function?

4) can you use a 'next' command (ie if I have several of the same
words in a file and I want to go to the next word and repeat the same
analysis until the file is complete. I see the repeat...until
combination but I am unclear on how to make it do this indefinately
until the end of a file)

Currently, I have a script worked up that is something like this:
form soundfiles
word textgrid
word sound
word vowel
natural voweltier
natural segmenttier
natural segment
word nametier

select TextGrid 'textgrid$'
plus Sound 'sound$'

Select next tier
tiers = tiers+1
until tiers = segment
Duplicate tier... 'segmenttier' 'nametier$'
# purpose is to move to the tier that is designated as the
vowel tier
pause voweltier is tier 'tiers'

Find... 'vowel$'
# where vowel$ = label of vowel in the voweltier
Get selection length = length
('length'/'segment')= segmentlength
# purpose is to determine length of segments when dividing
interval into n segments
Move cursor to begin of selection

segments = 0
Move cursor by... 'segmentlength'
Add interval on tier 'segmenttier'
segments = segments+1
label interval 'vowel$' 'segments'
until segments = 'segment' -1
pause the vowel 'vowel$' has been divided into 'segment' segments.
# divides the interval, with the labels in the form of vowel1 vowel2
vowel3.... voweln

find next... 'vowel$'

thank you very much for any assistance you are able to provide.

Amanda Owen