Community discussions

MikroTik App
 
Skream
just joined
Topic Author
Posts: 24
Joined: Mon Jun 12, 2017 10:48 am

Command result

Thu Jul 13, 2017 1:19 pm

Hello,

I need help for my script, i try to get a gateway with the command "find".
I have two routes with the same comment and the script get two id "*1,*2".
But i just need to get just the first id.

Command = :put [get [find comment=ISP1] gateway]
Result = invalid internal item number

Command = :put [find comment=ISP1]
Result = *3;*1

Thanks you.
 
Fritx
just joined
Posts: 1
Joined: Fri Jul 14, 2017 2:09 pm

Re: Command result

Fri Jul 14, 2017 2:13 pm

foreach i in=[/ip route get [find comment=ISP1] gateway]] do={:put $i}
 
Skream
just joined
Topic Author
Posts: 24
Joined: Mon Jun 12, 2017 10:48 am

Re: Command result

Mon Jul 17, 2017 10:43 am

Sorry but it does not work.

Command in terminal : foreach i in=[/ip route get [find comment=ISP1] gateway] do={:put $i}
Result : invalid internal item number
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Command result

Mon Jul 17, 2017 10:49 am

Use :pick to take only the first ID out of the list:
:put [get [:pick [find comment=ISP1] 0] gateway]
 
Skream
just joined
Topic Author
Posts: 24
Joined: Mon Jun 12, 2017 10:48 am

Re: Command result

Mon Jul 17, 2017 11:06 am

Thanks you, it's work !

It's Solved.

Who is online

Users browsing this forum: No registered users and 12 guests