This script moves all entries tagged with @done in the current project to the end of the current projects list of entries.
tell application "TaskPaper"
tell front document
set p to containing project of selected entry
set move_entry_ids to {}
set done_entry_ids to {}
repeat with each in entries of p
if exists (tag named "done" of each) then
set done_entry_ids to done_entry_ids & id of each
else
set move_entry_ids to move_entry_ids & done_entry_ids
set done_entry_ids to {}
end if
end repeat
repeat with each in move_entry_ids
move entry id each to end of entries of p
end repeat
end tell
end tell