Enable Lua errors:
Code:
/console scriptErrors 1
The second " indicates the end of macrotext.
Therfore in example 2 your macrotext is cut off.
If you want to use special characters inside a string you must escape them.
Code:
local macrotext = "/script SetLootMethod(\"group\")"