-- This handler marks the book script, the page (background) scripts, and the scripts of
-- all objects on the pages (backgrounds) for removal. The scripts of viewers are not modified
-- because TB 1.53 doesn't support viewers.

to handle add_tags
	
	-- mark the book script

	if script of this book <> null and first textline of script of this book <> "-- REMOVE THIS SCRIPT" then
		put "-- REMOVE THIS SCRIPT" & crlf before first textline of script of this book
	end if

	-- for all pages of this book

	step p from 1 to pagecount of this book

		-- mark the script of this page

		if script of page p <> null and first textline of script of page p <> "-- REMOVE THIS SCRIPT" then
			put "-- REMOVE THIS SCRIPT" & crlf before first textline of script of page p
		end if

		put objects of page p into objs

		-- for all objects of this page

		step i from 1 to itemcount (objs)

			-- mark the script of this object

			if script of item i of objs <> null and first textline of script of item i of objs <> "-- REMOVE THIS SCRIPT" then
				put "-- REMOVE THIS SCRIPT" & crlf before first textline of script of item i of objs
			end if
		end step
	end step

	-- for all backgrounds of this book

	step b from 1 to backgroundcount of this book

		-- mark the script of this background

		if script of background id b <> null and first textline of script of background id b <> "-- REMOVE THIS SCRIPT" then
			put "-- REMOVE THIS SCRIPT" & crlf before first textline of script of background id b
		end if

		put objects of background id b into objs

		-- for all objects of this background

		step i from 1 to itemcount (objs)

			-- mark the script of this object

			if script of item i of objs <> null and first textline of script of item i of objs <> "-- REMOVE THIS SCRIPT" then
				put "-- REMOVE THIS SCRIPT" & crlf before first textline of script of item i of objs
			end if
		end step
	end step

end add_tags
