This script will find devices in the DHCP Server leases list with a string in the device name. The purpose is to find iPhones so we can rate limit their upload, so as to not consume all our uplink bandwidth on slow connections by putting them on an address list. Feel free to use or customize.
/system script add name=script1 owner=admin policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive source="/ip firew\ all address-list remove [find comment=\"dynamic iPhone catcher\" ]\r\ \n\r\ \n:foreach i in=[/ip dhcp-server lease find host-name~\"iPhone\"] do={\r\ \n/ip firewall address-list add address=[/ip dhcp-server lease get \$i addre\ ss] list=iPhones timeout=[/ip dhcp-server lease get \$i expires-after ] comm\ ent=\"dynamic iPhone catcher\" \r\ \n}\r\ \n\r\ \n:foreach i in=[/ip dhcp-server lease find host-name~\"iPad\"] do={\r\ \n/ip firewall address-list add address=[/ip dhcp-server lease get \$i addre\ ss] list=iPhones timeout=[/ip dhcp-server lease get \$i expires-after ] comm\ ent=\"dynamic iPhone catcher\" \r\ \n}"