how to save a IP Address (get from a domain) to a variable?

how to save a IP Address (get from a domain) to a variable? I want to use it to config dynamic VPN.

You can do it with resolve command
See examples
http://wiki.mikrotik.com/wiki/Manual:Scripting-examples#Resolve_host-name