Community discussions

MikroTik App
 
atillaeyice
just joined
Topic Author
Posts: 8
Joined: Mon Oct 31, 2016 8:57 pm

script get pppoe name to system identity

Mon Oct 31, 2016 9:02 pm

im trying to make script to get pppoe user name for an example "user1"@net to system identity automaticly so i want the part before @ to be taken is this possible to make ?

:local rescontent
:interface pppoe-client print file=ppoeusr.txt
:local fileContents [/file get [/file find name=ppoeusr.txt] contents];
:local variableName "user";
:local start [:find ($variableName . "=") $fileContents];
:set start ($start + [:len $variableName] + 1);
:local end [:find $fileContents " " $start];
:local value [:pick $fileContents $start $end];
:put ("The value of '$variableName' is: " . $value);
:system identity set name=$value


i tried this but than id doesnt get correct values
 
atillaeyice
just joined
Topic Author
Posts: 8
Joined: Mon Oct 31, 2016 8:57 pm

Re: script get pppoe name to system identity

Tue Nov 01, 2016 10:36 am

any ideas what i been doing wrong