[HELP]Set NAT dst-address not work

i’m using this script to update nat dst-address.

/tool fetch url=“https://wtfismyip.com/text” mode=http dst-path=mypublicip.txt
:local currentIP1 [/file get mypublicip.txt contents]

:log info “Fetched current IP as $currentIP1”

/ip firewall nat set 1 dst-address=$currentIP1
var $currentIP1 not work, but work if manual input, dst-address=“123.123.111.111”

:log info " $currentIP1" <-this work show ip adress

please help..

Thank you

Common problem. Use [:tochar ] (correction) [:tostr ] to turn variable contents into a string instead of a numeric address.

tks for ur replay that give me idea. “tochar” i count char on txt file, that site have empty line in txt file :open_mouth:

Sorry, I misspoke. The function is :tostr, not :tochar.

https://wiki.mikrotik.com/wiki/Manual:Scripting#Commands