thanks. I will test it and write the results.
Okay, here are the results:
First of all, the script ran just fine on v.42.06 dfhack. I enabled cannibalism for my dwarves and embarked. Luckily, there was a group of raven people in my embark site, so I killed one using dfhack. The corpse went to the corpse stockpile as normal. Then I ran the script. A dwarf soon moved it to the refuse stockpile and then butchered it. The butchery products went where they were supposed to, and I managed to make a totem out of the luckless bird guy. So, as far as wildlife and presumably invaders are concerned, it works fine.
Then I killed a dwarf to see if the script would butcher him too. Here's where things got weird: Even in a cannibal civilization, it didn't butcher him (although it considered the corpse "remains"). When I tried to entomb him, however, my dwarves started to endlessly move the body from the tomb to the refuse stockpile and back to the tomb.
I tested it again, this time with a non cannibal civ and a sentient pet. After killing a cardinal man, I activated the script but they wouldn't butcher the corpse. Then I butchered the sentient pet and activated the script: The bones and the cartillage went to the refuse stockpile, but the meat, the fat and the skin remained in the corpse stockpile. I made some crafts out of his bones, but they wouldn't count the rest. Then, I tried to bury him. Again, they were moving the pieces from the stockpiles to the tomb.
Finally, I killed a dwarf, buried him and then activated the script. Thankfully, the already entombed dwarf remained where he was supposed to.
All in all, the script works but it has some issues.