%gui%[\"title"\] = {msg}
There are 2 problems:
1. You wrote the backslash after title behind the quotation mark, while it has to escape the quotation mark.
2. You didn't add quotation marks around {msg}
So it has to be %gui%[\"title\"] = \"{msg}\"
If you're editing through a dialog, you don't need to escape the quotation marks. In that case you just write %gui%["title"] = "{msg}"