Script: Clean strikethrough rows

The script only handles the selected rows and it’s not perfect.
Note the third and fourth lines.
.

tell front document of application "Bike"
	set rs to selection rows
	repeat with each in rs
		if exists character of text content of each then
			if strikethrough of text content of each is true then
				delete each
			end if
		end if
	end repeat
end tell

.

I’ve also been looking into removing parts of a row with partial strikethrough, but haven’t had any success yet, it seems to be because it can’t directly process the array with attributes obtained by attribute runs. Maybe?

Want to clean strikethrough parts
tell front document of application "Bike"
	set rs to selection row
	set rsa to attribute runs of text content of rs
	repeat with each in rsa
		if strikethrough of each is true then
			delete each
		end if
	end repeat
end tell

Alas I don’t have any idea why this works an your attempt didn’t, but this script is deleting strikethrough runs for me:

tell front document of application "Bike"
	set rs to selection rows
	repeat with eachRow in rs
		tell text content of eachRow
			delete (every attribute run whose strikethrough is true)
		end tell
	end repeat
end tell
2 Likes

Thank you! This script completely solves my problem!

1 Like