Meaning of script

Hi guys! I totally new in scripts could you plz help me in explanation!? Why I did get result - “no such item”
That is auto setup my mikrotik router for hotspot.

That part:
/put “### Setting up hotspot ###”
/ip hotspot
add address-pool=[/ip pool get number=0 value-name=name] disabled=no idle-timeout=none interface=[/interface bridge get 0 value-name=name] name=hotspot-mywifi profile=profile-mywifi addresses-per-mac=“”
/delay 5s

And output :
[admin@MikroTik] > ip hotspot
[admin@MikroTik] /ip hotspot> add address-pool=[/ip pool get number=0 value-name=name] disabled=no idle-timeout=none interface=[/interface bridge get 0 value-n
ame=name] name=hotspot-mywifi profile=profile-mywifi addresses-per-mac=“” /delay 5s
expected end of command (line 1 column 204)
[admin@MikroTik] /ip hotspot> add address-pool=[/ip pool get number=0 value-name=name] disabled=no idle-timeout=none interface=[/interface bridge get 0 value-n
ame=name] name=hotspot-mywifi profile=profile-mywifi addresses-per-mac=“”
no such item
[admin@MikroTik] /ip hotspot>


mkt_scrp.png

The “[/ip pool get number=0 value-name=name]” Seems to be the issue. The “number” parameter is only usable after a print command, and I don’t believe it is usable in a script at all.

Try this instead:

/put "### Setting up hotspot ###"
/ip hotspot
add address-pool=[/ip pool get [:pick [/ip pool find] 0] name] disabled=no idle-timeout=none interface=[/interface bridge get 0 name] name=hotspot-mywifi profile=profile-mywifi addresses-per-mac=""
/delay 5s

“[/ip pool find]” gets a list of all IP pools.
“[:pick 0]” gets the first item in the list.

Other than that, you don’t need to use the “value-name=” part of the “get” command.