Will I get banned for using this?
if they find out, yes. They have a one button one action policy, so they’ll class this as botting basically.
try using google.
Short answer: yes.
Long answer: everything that impacts the gameplay in a way that is not approved by anet (aka. not an ingame feature) is illegal and they will ban you for it.
How about a macro that writes Hallo! on the chat?
See #20 here:
https://www.guildwars2.com/en/legal/guild-wars-2-rules-of-conduct/
You may not use any third-party program (such as a “bot”) in order to automate gameplay functions, including playing, chatting, interacting, or gathering gold or items within Guild Wars 2. You may not assist, relay, or store gold or items for other players who are using these processes.
Also see:
https://forum-en.gw2archive.eu/forum/game/gw2/Are-simple-macros-illegal/771805
ty for redirecting me to the official answer