
Hi Alex, You need to declare the variables outside of the if statement to be able to access them, otherwise they're only accessible from the scope of which they were created in. For example: # set local hostname :global hostname [/system identity get name] :global LocalIP :global ManagementIP :global PublicIP :global PrivateIP :global RouterID :if ( $hostname = "artr1" ) \ do={ :global LocalIP 192.168.0.1 :global ManagementIP 1.3.8.72 ... This will work. Regards, Ben Farmer -----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Alex Samad - Yieldbroker Sent: Tuesday, 7 February 2017 10:31 To: MikroTik Australia Public List <public@talk.mikrotik.com.au> Subject: [MT-AU Public] scripting Hi I have this I a test.rsc file which I scp over and then I do /import test.rsc But it doesn't print anything for the variable # set local hostname :global hostname [/system identity get name] :if ( $hostname = "artr1" ) \ do={ :global LocalIP 192.168.0.1 :global ManagementIP 1.3.8.72 :global PublicIP 2.7.3.67 :global PrivateIP 1.3.200.10 :global RouterID 1.3.255.10 } :if ( $hostname = "artr2" ) \ do={ :global LocalIP 192.168.0.2 :global ManagementIP 1.3.8.73 :global PublicIP 2.7.3.68 :global PrivateIP 1.3.200.11 :global RouterID 1.3.255.11 } :if ( $hostname = "bextrtr1" ) \ do={ :global LocalIP 192.168.0.1 :global ManagementIP 1.3.8.70 :global PublicIP 2.7.3.69 :global PrivateIP 1.3.200.12 :global RouterID 1.3.255.12 } :if ( $hostname = "bextrtr2" ) \ do={ :global LocalIP 192.168.0.2 :global ManagementIP 1.3.8.71 :global PublicIP 2.7.3.70 :global PrivateIP 1.3.200.13 :global RouterID 1.3.255.13 } # vrrp dgw :global PublicVRRPIP 2.7.3.71 # # Validate variables # :put "Hostname: $hostname" :put "Local IP: $LocalIP" :put "Management IP: $ManagementIP" :put "Public IP: $PublicIP" :put "Private IP: $PrivateIP" :put "Routerid: $RouterID" _______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au