Changing number characters to bold formatting in TextEdit

Hi

I’m trying to write an AppleScript to convert all number characters to bold formatting in TextEdit. The script below is as far as I’ve got, and it converts everything to bold, not just numbers. Could someone advise me as to what I need to change to get it working.

Thanks

Nick

tell application "TextEdit"
	
	tell first document
		
		set theNumbers to "0123456789"
		
		repeat with i in theNumbers
			set font to "Optima Bold"
		end repeat
		
	end tell
end tell

Not sure exactly how this would be done, but I know you need an RTF document. Make sure it’s not plain-text because you can’t specify certain characters to be different in plain-text.

Just making sure. :smiley:

tell application "TextEdit"
	
	tell first document's text
		set font of (every character where (it is "0") or (it is "1") or (it is "2") or (it is "3") or (it is "4") or (it is "5") or (it is "6") or (it is "7") or (it is "8") or (it is "9")) to "Optima bold"
	end tell
end tell

It may take a while if it’s a long document!

Thanks Nigel. That worked a treat.

Nick