Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15133

Scripting • Foreach Problem

$
0
0
Hello all,
I need help
I write the script for send text to telegram
the text is output from foreach
but i have a problem
the text success to send to my bot on telegram but the value is corrupt

the output just send to my bot just one line
acctually output is 3 line
how to fix my problem?

this is my script
#Print UserOFF#
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
:local offuser;
:foreach i in=[/system sch find where comment=offuser] do={
:local useroff ([/system sch get $i name]);
:set offuser ($useroff);
/tool fetch url="https://api.telegram.org/bot$bot/sendme ... t=$useroff
}
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------#

this is output from foreach

:local offuser; :foreach i in=[/system sch find where comment=offuser] do={ :local useroff ([/system sch get $i name]); :set offuser ($useroff); :put $offuser};
ida@sm.net
adi@sm.net
dai@sm.net


the bot ust received text one line
ida@sm.net

Note : adi@sm.net and dai@sm.net not send to my bot

i want to send the text like this to my bot

1. ida@sm.net
2. adi@sm.net
3. dai@sm.net

Statistics: Posted by AASHS — Fri Jan 26, 2024 8:46 pm



Viewing all articles
Browse latest Browse all 15133

Trending Articles