Community discussions

MikroTik App

Search found 23 matches

by pepelxl
Sun Jan 24, 2021 10:45 am
Forum: Scripting
Topic: Script for sending incoming SMS to mail with full parsing
Replies: 3
Views: 5427

Re: Script for sending incoming SMS to mail with full parsing

The current version can be found at this link . According to reviews, the script was heavily reworked. The main innovation-added automatic search for modems. However, we must remember that the script only works with modems that have an AT interface. Also, according to reviews, the script does not wo...
by pepelxl
Sun Sep 06, 2020 10:31 am
Forum: Scripting
Topic: find highest and lowest array value [SOLVED]
Replies: 2
Views: 1034

Re: find highest and lowest array value [SOLVED]

:local array [:toarray (9,5,7,1,2)]
:local highest ($array->0)
:local lowest ($array->0)
:foreach i in=$array do={
:if ($i > $highest) do={:set $highest $i}
:if ($i < $lowest) do={:set $lowest $i}
}
:log info "highest = $highest"
:log info "lowest = $lowest"
by pepelxl
Sat Jul 25, 2020 10:58 am
Forum: Scripting
Topic: Help creating a named array
Replies: 2
Views: 1241

Re: Help creating a named array

found such a solution
{
:local struct [:toarray ""]
:local n "name"
:local v "value"
:set $struct ($struct , [[:parse "({\"$n\"=\"$v\"})"]])
:put [:len $struct]
:put [:typeof $struct]
:put $struct
}
by pepelxl
Sat Jul 25, 2020 10:53 am
Forum: Scripting
Topic: convert string to a map
Replies: 1
Views: 1159

Re: convert string to a map

Another example: :local arrElements "a=1,b=2,c=3" :local tmp :for i from=0 to=([:len $arrElements] - 1) do={ :if ([:pick $arrElements $i] != ",") do={:set $tmp ($tmp.[:pick $arrElements $i]) } else={:set $tmp ($tmp.";")} } :local arr4 [[:parse "({$tmp})"]] :fo...
by pepelxl
Thu Jul 23, 2020 9:33 am
Forum: Scripting
Topic: Regular Expressions modificators?
Replies: 3
Views: 2256

Re: Regular Expressions modificators?

thanks, "OK" can be anywhere. It is also believed that the modems return the newline as "\r\n"
did this:
~"(^|\n)OK(\$|\r)"
.

But, the case-insensitive modifier is no longer missing(?i)
It's a shame that things like this are not supported.
by pepelxl
Thu Jul 16, 2020 11:03 am
Forum: Scripting
Topic: Regular Expressions modificators?
Replies: 3
Views: 2256

Regular Expressions modificators?

There is a text: OK ^RSSI: 25 ^HCSQ: "LTE",59,52,156,28 It is necessary here to catch the presence of a full line "OK" The regular message does not work out as I need it: { :local str "OK\r\n^RSSI: 25\r\n^HCSQ: \"LTE\",59,52,156,28" :if ($str~"^OK\$"...
by pepelxl
Wed Jun 03, 2020 10:17 am
Forum: Scripting
Topic: Script for sending incoming SMS to mail with full parsing
Replies: 3
Views: 5427

Script for sending incoming SMS to mail with full parsing

The second release of my script for sending incoming sms to mail in its original form. The beginning was laid here . I decided to create a separate topic, because the script crossed the border of simple forwarding and turned into a full-fledged sms body parsing (PDU). PDU - a format in which a messa...
by pepelxl
Sat May 16, 2020 5:08 pm
Forum: Scripting
Topic: Help creating a named array
Replies: 2
Views: 1241

Re: Help creating a named array

this seems to be a bug that the developers didn't give a damn about.
This problem was at least discussed back in 2016:

viewtopic.php?f=9&t=113863#p565863
by pepelxl
Sat May 16, 2020 11:47 am
Forum: Scripting
Topic: Help creating a named array
Replies: 2
Views: 1241

Help creating a named array

It is necessary to create a named three-dimensional array. I’ve been stomping the third day, I can’t find a mistake. the name of the keys is not known in advance; therefore, they must be added in the process. An example that works: :local key1 "D04DEA1091709160632421214"; :local key2 "...
by pepelxl
Fri Sep 27, 2019 11:33 am
Forum: Scripting
Topic: Script email and char accents [SOLVED]
Replies: 9
Views: 10144

Re: Script email and char accents [SOLVED]

They gave you a solution and explained why this happens. You can think of the rest yourself. Code pages consist of 1 byte (except utf), i.e. 256 values ​​are available. The first 128, as a rule, are identical and equal to the ASCII table. The rest belong to a specific set of characters. In the email...
by pepelxl
Thu Sep 26, 2019 9:51 pm
Forum: Scripting
Topic: Script email and char accents [SOLVED]
Replies: 9
Views: 10144

Re: Script email and char accents [SOLVED]

characters é and è are not represented by ASCII characters. When you write a script, the OS remembers the hex value of the character of the current encoding. It is this hex value that is transmitted in the email. The mail client displays a letter depending on its regional settings. Character é conve...
by pepelxl
Thu Sep 26, 2019 9:19 am
Forum: Scripting
Topic: Script email and char accents [SOLVED]
Replies: 9
Views: 10144

Re: Script email and char accents [SOLVED]

script example?
At a minimum, you must specify the encoding in the message you send.
example:
/tool e-mail send to=example@mail.domain subject="Mikrotik\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8"
by pepelxl
Fri Jul 26, 2019 1:18 pm
Forum: Scripting
Topic: Help on script to extract SMS inbox text message
Replies: 13
Views: 12234

Re: Help on script to extract SMS inbox text message

International SMS in encoding UCS2 #Скрипт пересылки SMS на email. # Автор: pepelxl, 07.2019. # Немного памятки: # из модема sms можно извлечь в двух режимах – PDU и text # Текст передаётся в трёх кодировках : # 7bit – 160 символов # 8bit – 140 символов # UCS2 – 70 символов # в режиме text, модем са...
by pepelxl
Sat Jul 20, 2019 8:03 am
Forum: Scripting
Topic: status of the sent email? [SOLVED]
Replies: 4
Views: 12114

Re: status of the sent email? [SOLVED]

Thanks you.
by pepelxl
Fri Jul 19, 2019 4:45 pm
Forum: Scripting
Topic: status of the sent email? [SOLVED]
Replies: 4
Views: 12114

status of the sent email? [SOLVED]

Is it possible to check the status of the sent email?
Learn the script execution status, example:
/tool e-mail send to=exemple@mail.ru subject="Mikrotik" body=hello
:if (email send....) do=
by pepelxl
Wed Jul 17, 2019 2:55 pm
Forum: Scripting
Topic: int-to-string?
Replies: 10
Views: 4305

Re: int-to-string?

Exactly. I work with representations of numbers.
72dex = 48h
216dex = D8h
by pepelxl
Wed Jul 17, 2019 12:57 pm
Forum: Scripting
Topic: int-to-string?
Replies: 10
Views: 4305

Re: int-to-string?

vytuz, no, you will have a different result.
My example works as I need.
Can you put it up?
Get rid of the array?
by pepelxl
Tue Jul 16, 2019 11:18 pm
Forum: Scripting
Topic: int-to-string?
Replies: 10
Views: 4305

Re: int-to-string?

example: :local int 72; :local output ""; :local symbolsHex {"\00";"\01";"\02";"\03";"\04";"\05";"\06";"\07";"\08";"\09";"\0A";"\0B";"\0C";"\0D";"...
by pepelxl
Tue Jul 16, 2019 5:37 pm
Forum: Scripting
Topic: int-to-string?
Replies: 10
Views: 4305

Re: int-to-string?

Yes.
string must be able to contain all bytes (256)
by pepelxl
Tue Jul 16, 2019 4:22 pm
Forum: Scripting
Topic: int-to-string?
Replies: 10
Views: 4305

Re: int-to-string?

not what you need.
srting = one byte (0x46)
by pepelxl
Tue Jul 16, 2019 3:54 pm
Forum: Scripting
Topic: int-to-string?
Replies: 10
Views: 4305

int-to-string?

Can you please tell me the transform int-to-string?
#I have one byte:
:local int 46;
:local output "";
#It is necessary to convert the int into a string, what would be the value: output "\46"
by pepelxl
Tue Jun 18, 2019 12:44 pm
Forum: General
Topic: Loss of the first byte in at-chat.
Replies: 0
Views: 747

Loss of the first byte in at-chat.

Hi, I encountered data loss in at-chat with a Huawei modem. Working sample in mode: /port firmware set ignore-directip-modem=yes MikroTik RouterOS 6.44.3 (c) 1999-2019 http://www.mikrotik.com/ [pepelxl@Dacha] > /system serial-terminal port=usb1 channel=4 [Ctrl-A is the prefix key] ati Manufacturer: ...