This works how I want it to pretty much perfectly, but it has so many essentially repetitive statements in it. I am wondering if someone can help me simplify it some what. One idea I had was to set selection ranges, but I could not get it to work well. Thanks for any suggestions.
tell application "Adobe InDesign CS2"
set foundText to {}
set replaceText to {}
tell document 1
set Numerator to make character style with properties {name:"numerator", position:superscript, fill color:"Black"}
set Denominator to make character style with properties {name:"denominator", horizontal scale:58.3, vertical scale:58.3, fill color:"Black"}
set TENSfr to search for "-^9/^9"
set HUNSfr to search for "-^9^9/^9^9"
set THOUfr to search for "-^9^9^9/^9^9^9"
set TENSoverHuns to search for "-^9/^9^9"
set TENSoverTHOU to search for "-^9/^9^9^9"
set HUNSoverTHOU to search for "-^9^9/^9^9^9"
end tell
try
repeat with i from 1 to count of TENSfr
set applied character style of character 2 of item i of TENSfr to "numerator"
set applied character style of character 4 of item i of TENSfr to "denominator"
end repeat
end try
try
repeat with i from 1 to count of HUNSfr
set applied character style of character 2 of item i of HUNSfr to "numerator"
set applied character style of character 3 of item i of HUNSfr to "numerator"
set applied character style of character 5 of item i of HUNSfr to "denominator"
set applied character style of character 6 of item i of HUNSfr to "denominator"
end repeat
end try
try
repeat with i from 1 to count of THOUfr
set applied character style of character 2 of item i of THOUfr to "numerator"
set applied character style of character 3 of item i of THOUfr to "numerator"
set applied character style of character 4 of item i of THOUfr to "numerator"
set applied character style of character 6 of item i of THOUfr to "denominator"
set applied character style of character 7 of item i of THOUfr to "denominator"
set applied character style of character 8 of item i of THOUfr to "denominator"
end repeat
end try
try
repeat with i from 1 to count of THOUfr
set applied character style of character 2 of item i of THOUfr to "numerator"
set applied character style of character 3 of item i of THOUfr to "numerator"
set applied character style of character 4 of item i of THOUfr to "numerator"
set applied character style of character 6 of item i of THOUfr to "denominator"
set applied character style of character 7 of item i of THOUfr to "denominator"
set applied character style of character 8 of item i of THOUfr to "denominator"
end repeat
end try
try
repeat with i from 1 to count of TENSoverHuns
set applied character style of character 2 of item i of TENSoverHuns to "numerator"
set applied character style of character 4 of item i of TENSoverHuns to "denominator"
set applied character style of character 5 of item i of TENSoverHuns to "denominator"
end repeat
end try
try
repeat with i from 1 to count of TENSoverTHOU
set applied character style of character 2 of item i of TENSoverTHOU to "numerator"
set applied character style of character 4 of item i of TENSoverTHOU to "denominator"
set applied character style of character 5 of item i of TENSoverTHOU to "denominator"
set applied character style of character 6 of item i of TENSoverTHOU to "denominator"
end repeat
end try
try
repeat with i from 1 to count of HUNSoverTHOU
set applied character style of character 2 of item i of HUNSoverTHOU to "numerator"
set applied character style of character 3 of item i of HUNSoverTHOU to "numerator"
set applied character style of character 5 of item i of HUNSoverTHOU to "denominator"
set applied character style of character 6 of item i of HUNSoverTHOU to "denominator"
set applied character style of character 7 of item i of HUNSoverTHOU to "denominator"
end repeat
end try
end tell