I figured it out. I'm sure this seems not very automatic, but it's good for if you want to only measure specific things. Here's the code if this will help anyone else.
##################################
# Input sound file name here #
##################################
.sound$ = "*INSERT SOUND NAME HERE*"
select Sound '.sound$'
#################################################
# Select correct formant values based on sex #
#################################################
# for men
# To Formant (burg)... 0 5 4500 0.025 50
# for women
To Formant (burg)... 0 5 5500 0.025 50
#######################
# Input times here #
#######################
begin_vowel = *INSERT START TIME OF SEGMENT*
end_vowel = *INSERT END TIME OF SEGMENT*
duration_vowel = end_vowel - begin_vowel
midway = begin_vowel + duration_vowel/2
ninetynine = begin_vowel + 0.99 * duration_vowel
select Formant '.sound$'
f2_mid = Get value at time... 2 midway Hertz Linear
f3_mid = Get value at time... 3 midway Hertz Linear
f2_end = Get value at time... 2 ninetynine Hertz Linear
f3_end = Get value at time... 3 ninetynine Hertz Linear
# creates csv text file
appendFileLine: "formants.txt", "'f2_mid', 'f3_mid', 'f2_end', 'f3_end'"
Edit: You can also do this for multiple things using a procedure.
############################################
# Input vowel, sound file name, start time, end time, formant values, number of formants #
############################################
@instance: "ae", "sbc006_1441_88_1443_71", 1.185, 1.251820, 5500, 5
procedure instance: .vowel$, .sound$, .start, .end, .hertz, .num
select Sound '.sound$'
#################################################
# Select correct formant values based on sex #
#################################################
To Formant (burg)... 0 .num .hertz 0.025 50
begin_vowel = .start
end_vowel = .end
duration_vowel = end_vowel - begin_vowel
midway = begin_vowel + duration_vowel/2
ninetynine = begin_vowel + 0.99 * duration_vowel
select Formant '.sound$'
f2_mid = Get value at time... 2 midway Hertz Linear
f3_mid = Get value at time... 3 midway Hertz Linear
f2_end = Get value at time... 2 ninetynine Hertz Linear
f3_end = Get value at time... 3 ninetynine Hertz Linear
# creates tab delimited text file
appendFileLine: "sbc006formants.txt", "'.sound$' 'tab$' '.vowel$' 'tab$' 'f2_mid' 'tab$' 'f3_mid' 'tab$' 'f2_end' 'tab$' 'f3_end'"
endproc
writeInfoLine: "Finished!"