How to obtain the list of route marks programmatically

Hello Guys,

I’m writing a complex RouterOS script right now. I need to obtain the list of route marks, my Mikrotik router has 3 route marks, let say “route_mark1”, “route_mark2” and “route_mark3”. So for now I couldn’t find the commands which will retrieve this list. In the end I should have a local variable as an array initialized with this list:
:local localRouteMarks {“route_mark1”, “route_mark2”, “route_mark3”};

Could someone help me and provide the piece of code which I need ?

Thank you

Have a look at this post: using some of these commands you could build an array with all marks: http://forum.mikrotik.com/t/got-http-to-update-ddns-but-cant-figure-scrip-to-do-this/48373/15

sebastia, Thank you Sir, from the source which you’ve gave me, I was able to build this code :

:global retrieveAllRouteMarks do={
   :local currentMark;\
   :local allMarks [:toarray ""];\
   :foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes] do={\
      :set currentMark ([/ip route get $int routing-mark]);\ 
      if ([:len $currentMark] > 0) do={\
          :set allMarks [($allMarks, $currentMark)];
      }\    
   };\
  :return $allMarks;\	
};