Community discussions

MikroTik App

Search found 408 matches

  • 1
  • 2
by diamuxin
Fri Jan 31, 2025 4:36 pm
Forum: Announcements
Topic: v7.18beta [testing] is released!
Replies: 573
Views: 168446

Re: v7.18beta [testing] is released!

The fasttrack rule does not exist in the default configuration (you have to create it), it is not clear to me in which position it should go. If you follow advice by @pe1chl, you'll place it as the very first rule in chain=forward, above this rule: filter add chain=forward action=accept connection-...
by diamuxin
Thu Jan 30, 2025 10:11 pm
Forum: Announcements
Topic: v7.18beta [testing] is released!
Replies: 573
Views: 168446

Re: v7.18beta [testing] is released!

You can display the defconf using: /system/default-configuration/print The fasttrack rule does not exist in the default configuration (you have to create it), it is not clear to me in which position it should go. /ipv6 firewall { > address-list add list=bad_ipv6 address=::/128 comment="defconf...
by diamuxin
Thu Jan 30, 2025 9:16 pm
Forum: Announcements
Topic: v7.18beta [testing] is released!
Replies: 573
Views: 168446

Re: v7.18beta [testing] is released!

Hi, What is the position of Fasttrack rules in the IPv6 firewall? /ipv6 firewall filter add action=fasttrack-connection chain=forward comment="Enable FastTracked v6 traffic" connection-state=established,related add action=accept chain=forward comment="accept established,related,untrac...
by diamuxin
Sun Jan 05, 2025 8:51 pm
Forum: Scripting
Topic: verify update RouterOS, with memory
Replies: 11
Views: 4772

Re: verify update RouterOS, with memory

...
by diamuxin
Tue Dec 31, 2024 12:49 pm
Forum: Scripting
Topic: script problem
Replies: 4
Views: 4639

Re: script problem

This is how you help others, explaining the why of things, so we all learn.

Thanks @tarasfilatov
by diamuxin
Tue Dec 31, 2024 12:35 pm
Forum: Scripting
Topic: Netwatch is not working properly
Replies: 5
Views: 3847

Re: Netwatch is not working properly

Sorry, timeout is 3m20s. I see with the VMping program that a few packets or a few dozen are lost, but they appear within the specified time, and netwatch is still able to execute the script. # TYPE HOST PORT TIMEOUT INTERVAL STATUS SINCE 0 icmp 10.14.1.16 80 3m20s 4m up 2024-12-31 01:02:43 Test as...
by diamuxin
Sat Dec 21, 2024 9:21 pm
Forum: Scripting
Topic: Script to auto create address-list from plain ip-ranges URLs
Replies: 10
Views: 4502

Re: Script to auto create address-list from plain ip-ranges URLs

Miguel,

The CLOUDFLARE list is locked in RAW?
/ip firewall raw
add action=drop chain=prerouting src-address-list=CLOUDFLARE
thx.
by diamuxin
Fri Dec 20, 2024 7:11 pm
Forum: Scripting
Topic: Script to auto create address-list from plain ip-ranges URLs
Replies: 10
Views: 4502

Re: Script to auto create address-list from plain ip-ranges URLs

Compatible with both IPv4, IPv6 and survives reboots. A 1d interval scheduler is enough. https://gist.github.com/miguelangel-nubla/137fea6653a3d612ca66cd7f8ea7edb6 This is based on someone else script I used for long time, can't find source. Please let me know to give credit. Very useful, thanks.
by diamuxin
Mon Dec 16, 2024 4:57 pm
Forum: Scripting
Topic: executing script from net failed
Replies: 35
Views: 7157

Re: executing script from net failed

If you don't publish the content of your script, it will be difficult for them to help you.
by diamuxin
Wed Dec 04, 2024 12:51 pm
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Re: Running a script from Netwatch doesn't work

can be saved also as json... Now with v7 better use also serialize/deserialize with json Yes, I have tried (for academic purposes) the possibility of using JSON from Netwatch, but I have had no luck, if I try to write (:serialize) from a Netwatch script window, I get the typical error: “executing s...
by diamuxin
Wed Dec 04, 2024 12:49 pm
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Re: Running a script from Netwatch doesn't work

duplicate
by diamuxin
Sun Dec 01, 2024 9:04 am
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Re: Running a script from Netwatch doesn't work

Yes, but It seems more complicated and bloats log, also log has limit so there is a chance that record can be lost for reading. ROS config is easy to create for tmpfs mount, eg. to create on /tmp path: /disk add media-interface=none media-sharing=no slot=tmp tmpfs-max-size=1M type=tmpfs Files store...
by diamuxin
Sat Nov 30, 2024 6:43 pm
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Re: Running a script from Netwatch doesn't work

The problem is the misleading name: "global" is a user session. ideal => actual :global => <NOT EXIST>, but a file content in store, json, or parameters in layer7 and similar can be used for store simple values. <user> => :global <MISLEADING NAME> <session> => :local at the script start :...
by diamuxin
Sat Nov 30, 2024 1:44 pm
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Re: Running a script from Netwatch doesn't work

OK, thanks Rex
Molto cordiali.

PS: I do not understand how after so many years Mikrotik has not solved the problem of a “super-admin” user not being able to work with global variables or execute scripts from Netwatch or from the DHCP Client/Server. Too bad.
by diamuxin
Sat Nov 30, 2024 1:23 pm
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Re: Running a script from Netwatch doesn't work

dont-require-permissions=yes
I tried it, it doesn't work either

Thx.
by diamuxin
Sat Nov 30, 2024 12:39 am
Forum: Scripting
Topic: Running a script from Netwatch doesn't work
Replies: 14
Views: 4498

Running a script from Netwatch doesn't work

I am aware that Netwatch UP/Down/Test scripts do not work with global variables and that it can only run scripts with the "read, write, test and reboot" policies, I have created a Netwatch task and a system script. Netwatch Task /tool netwatch add disabled=no down-script=":log warning...
by diamuxin
Mon Oct 21, 2024 1:44 am
Forum: Scripting
Topic: Search for a mac-address in the Bridge-Host or ARP table to extract the interface
Replies: 2
Views: 3018

Re: Search for a mac-address in the Bridge-Host or ARP table to extract the interface

A way to simplify it a little, similar to the last problem, break the logic into two modular parts: { :local bridHost [/interface/bridge/host/print as-value] :local arpTable [/ip/arp/print as-value] :local iFace "*no interface*" # The following MACs are for testing purposes: # :local macA...
by diamuxin
Sun Oct 20, 2024 8:03 pm
Forum: Scripting
Topic: Search for a mac-address in the Bridge-Host or ARP table to extract the interface
Replies: 2
Views: 3018

Search for a mac-address in the Bridge-Host or ARP table to extract the interface

Hi folks. In the following code snippet, it does not work when the MAC address does not exist in the Bridge Host table or ARP table to extract the corresponding interface. Where is the error? { :local bridHost [/interface/bridge/host/print as-value] :local arpTable [/ip/arp/print as-value] :local iF...
by diamuxin
Sat Oct 19, 2024 10:50 pm
Forum: Scripting
Topic: Enhanced IP Scan with Vendor and Additional Name Sources
Replies: 27
Views: 9302

Re: Enhanced IP Scan with Vendor and Additional Name Sources

Might be better to start a new thread to work on your scripts, but in the interest of good spirit.
It works correctly, thank you.

You are right, I should have opened a new post, sorry.
by diamuxin
Sat Oct 19, 2024 11:05 am
Forum: Scripting
Topic: Enhanced IP Scan with Vendor and Additional Name Sources
Replies: 27
Views: 9302

Re: Enhanced IP Scan with Vendor and Additional Name Sources

Hi! @excession could you please help me? In the following code snippet, it does not work when the MAC address does not exist in the Bridge Host table, it gives me an empty result, I should see *NOT AVAILABLE*. If the MAC address does exist it reports your interface correctly. Where is the error? Tha...
by diamuxin
Wed Oct 16, 2024 8:09 pm
Forum: Scripting
Topic: Enhanced IP Scan with Vendor and Additional Name Sources
Replies: 27
Views: 9302

Re: Enhanced IP Scan with Vendor and Additional Name Sources

Updated 16-10-24 Code above is updated, now sorts by IP address! I'm sure my sorting method is horrific, please do chime in if you can tidy it up / make 1000% better by re-writing it. Hi, Could your script be adapted to get some data from the DHCP-Server/Leases screen only? I need to list the hosts...
by diamuxin
Wed Oct 16, 2024 12:57 pm
Forum: Scripting
Topic: Enhanced IP Scan with Vendor and Additional Name Sources
Replies: 27
Views: 9302

Re: Enhanced IP Scan with Vendor and Additional Name Sources

Very useful your script, thank you!

BR.
by diamuxin
Thu Oct 10, 2024 10:54 pm
Forum: Announcements
Topic: 📣 WinBox 4 is here 📣
Replies: 2143
Views: 1306951

Re: 📣 WinBox 4 is here 📣

no color in the logs ( only black ).
+1
by diamuxin
Tue Sep 24, 2024 5:31 pm
Forum: Announcements
Topic: v7.16.2 [stable] is released!
Replies: 506
Views: 248141

Re: v7.16 [stable] is released!

So, it seems to be a bug affecting “ether1” as I have tested that port as POE=Off and the same thing happens again. Edit: I have downgraded to version 7.15.3 and still the same problem: “ether1 link down” -> “ether1 link up” -> “ether1 link down” ...etc. Any solution from Support ? I've got an HAP ...
by diamuxin
Tue Sep 24, 2024 2:41 pm
Forum: Announcements
Topic: v7.16.2 [stable] is released!
Replies: 506
Views: 248141

Re: v7.16 [stable] is released!

I have downgraded to version 7.15.3 and still the same problem That is not an answer to the question above. Did you upgrade from 7.15.3 to 7.16 or did you try 7.16x versions in between? (beta,rc) There have been changes to PoE and they affect the programming of a PoE controller, downgrading does no...
by diamuxin
Tue Sep 24, 2024 1:58 pm
Forum: Announcements
Topic: v7.16.2 [stable] is released!
Replies: 506
Views: 248141

Re: v7.16 [stable] is released!

I have downgraded to version 7.15.3 and still the same problem
by diamuxin
Tue Sep 24, 2024 1:46 pm
Forum: Announcements
Topic: v7.16.2 [stable] is released!
Replies: 506
Views: 248141

Re: v7.16 [stable] is released!

So, it seems to be a bug affecting “ether1” as I have tested that port as POE=Off and the same thing happens again.

Edit: I have downgraded to version 7.15.3 and still the same problem: “ether1 link down” -> “ether1 link up” -> “ether1 link down” ...etc. Any solution from Support ?
by diamuxin
Tue Sep 24, 2024 1:18 pm
Forum: Announcements
Topic: v7.16.2 [stable] is released!
Replies: 506
Views: 248141

Re: v7.16 [stable] is released!

Hi, I have an ax3 and behind it powered by POE (from ether1) an ax2 is connected. Since I have upgraded both devices to 7.16 there is a continuous error on ax3 “ether1 link down” -> “ether1 link up” -> “ether1 link down” and so it repeats continuously. Any idea where the problem comes from? Thanks.
by diamuxin
Tue Aug 20, 2024 6:02 pm
Forum: Scripting
Topic: Get the status of a wireless interface
Replies: 0
Views: 5017

Get the status of a wireless interface

Hi friends, How can I get the status of an interface (of a external CAP unit) from CAPsMAN (running, not running or cac)? For example, I have tried this way but it is not possible: :put [/interface/wifi/get [find name=5G-Salon] value-name=state] input does not match any value of value-name Thanks.
by diamuxin
Fri Jul 19, 2024 12:47 pm
Forum: Scripting
Topic: Check Traffic Script
Replies: 3
Views: 4175

Re: Check Traffic Script

First, create this script/function so that it is always available as a global variable. :global human do={ :if ([:typeof $1]="nothing") do={ :error "must provide a byte value to humanize" } :local input [:tonum $1] :if ([:typeof $input]!="num") do={ :error "cannot ...
by diamuxin
Wed Jul 17, 2024 2:01 pm
Forum: Scripting
Topic: Address List triggers
Replies: 8
Views: 3660

Re: Address List triggers

Bravo Rex! (as always)
by diamuxin
Fri May 10, 2024 6:47 pm
Forum: Beginner Basics
Topic: USB disk files directory disappears.
Replies: 5
Views: 3437

Re: USB disk files directory disappears.

any solution?
by diamuxin
Tue Apr 09, 2024 8:59 pm
Forum: Announcements
Topic: NEW FEATURE: Back to Home VPN
Replies: 469
Views: 536603

Re: NEW FEATURE: Back to Home VPN

With the latest beta (7.15beta9), I now get this new message all the time when disconnecting (peer with resolver checked)
back-to-home-vpn: [peer19] CHWCHPuLuweWVZkq3r2HynUP59yxk3GsMX4i9XamAQw=: Handshake for peer did not complete after 20 attempts, giving up
by diamuxin
Tue Mar 19, 2024 12:13 pm
Forum: Scripting
Topic: RouterOS get uptime days [SOLVED]
Replies: 10
Views: 11107

Re: RouterOS get uptime days [SOLVED]

Please use the code tag, to avoid Cool smile face when posting code pre formatted.
Key </>
OK
by diamuxin
Tue Mar 19, 2024 11:35 am
Forum: Scripting
Topic: RouterOS get uptime days [SOLVED]
Replies: 10
Views: 11107

Re: RouterOS get uptime days [SOLVED]

I need the unit to be days. Try: # rextended's function (thanks Master) # Convert uptime to seconds :global timetoseconds do={ :local inTime $1 :local wPos [:find $inTime "w" -1] :local dPos [:find $inTime "d" -1] :local itLen [:find $inTime "." -1] ; :if ([:typeof $it...
by diamuxin
Sun Mar 17, 2024 11:59 pm
Forum: Scripting
Topic: Reprogramming WPS button to execute scripts [SOLVED]
Replies: 3
Views: 8868

Re: Reprogramming WPS button to execute scripts [SOLVED]

/system routerboard wps-button
set enabled=yes on-event=":if ([system leds settings get all-leds-off] = \"never\") do={\r\
    \n/system leds settings set all-leds-off=immediate \r\
    \n} else={\r\
    \n/system leds settings set all-leds-off=never \r\
    \n}"
by diamuxin
Sat Mar 16, 2024 9:13 pm
Forum: Scripting
Topic: How to delete backup and RSC files that have been stored for more than 1 month
Replies: 8
Views: 6230

Re: How to delete backup and RSC files that have been stored for more than 1 month

Hi ! Please, how could a counter be added to know the number of files that the cycle is going to delete? { :global datetime2epoch /system clock :local now [$datetime2epoch ("$[get date] $[get time]")] :local wait 2592000 ; # seconds, 1 month :local fdate 0 :local countFiles /file :foreach ...
by diamuxin
Wed Mar 13, 2024 2:15 pm
Forum: Scripting
Topic: get IP ADDRESSES on interface
Replies: 13
Views: 22423

Re: get IP ADDRESSES on interface

{
/ip cloud
:local ipv4 [get public-address]
:local ipv6 [get public-address-ipv6]
:put $ipv4
:put $ipv6
}
by diamuxin
Wed Mar 13, 2024 10:25 am
Forum: Scripting
Topic: Network address instead of IP address
Replies: 5
Views: 2414

Re: Network address instead of IP address

:global currentIP :local newIP [/ip address get [find interface="ether1"] address] :set newIP [:pick $newIP 0 [:find $newIP "/" -1]] :if ($newIP != $currentIP) do={ :put [/ip firewall/address-list/add list=wan_ip address=$newIP dynamic=yes] :put "ip address $currentIP chang...
by diamuxin
Tue Mar 12, 2024 4:30 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

Version 7.15 will include WireGuard peer functionality "responder". Then you will be able to mark your peer as "responder". Then the peer will not spam your log, if you enable this option manually.
Great news!
Thank you very very much.
by diamuxin
Tue Mar 12, 2024 12:42 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

of course this is expected behavior. people finally need to stop thinking of wireguard being just another server / client vpn software, which gives up after x unsuccessful connection attempts; it is not! once a peer has learned a peer's remote address, it will try to establish a connection indefini...
by diamuxin
Tue Mar 12, 2024 12:16 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

WireGuard fix solves an issue where RouterOS was trying to connect to peers which have not been used yet and there is no known endpoint-address. WireGuard is a bidirectional tunnel. Once you connect peer, it knows "last remote endpoint" information and tries to connect to it. Fix solved t...
by diamuxin
Tue Mar 12, 2024 9:53 am
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

We can compare the configs, just in case: Thanks for sharing: My roadwarrior configuration: /interface wireguard add comment="vpn: roadwarrior" listen-port=54321 mtu=1420 name=wg-rw /interface wireguard peers add allowed-address=<redacted>.30.2/32 comment="My Mobile" interface=w...
by diamuxin
Mon Mar 11, 2024 10:33 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

Nope, I don't...
Just tested, deliberately.
That is why I am actually wondering, maybe some specific config setting is involved.
Maybe, let's wait and see if someone from the staff can enlighten us.
Thx.
by diamuxin
Mon Mar 11, 2024 8:23 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

Must be something config specific, I do use wireguard for road-warrior setup and I have 0 such logs.
I don't use or have BTH though.
Try to connect with road-warrior and when you disconnect you will see that the handshak messages start coming out, this started since the first versions of 7.13.
by diamuxin
Mon Mar 11, 2024 8:14 pm
Forum: Announcements
Topic: NEW FEATURE: Back to Home VPN
Replies: 469
Views: 536603

Re: NEW FEATURE: Back to Home VPN

Idem...

With the latest update 7.14.1 the logging problems with the handshake have NOT been solved, both in the wireguard road-warrior links and with BTH.

Image

BR.
by diamuxin
Mon Mar 11, 2024 8:07 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

Mr. Support, with the latest update 7.14.1 the logging problems with the handshake have NOT been solved, both in the wireguard road-warrior links and with BTH. https://i.postimg.cc/kg0MwDQq/image.png 1. I have connected with the RW, I navigate a little bit and when I disconnect, the messages in the ...
by diamuxin
Mon Mar 11, 2024 1:28 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

Missing "routeros" directory: https://upgrade.mikrotik.com/routeros/7.14.1/CHANGELOG Hi, Access to CHANGELOG information via CLI does not work: [admin@MikroTik] > :put ([/tool fetch "https://upgrade.mikrotik.com/7.14.1/CHANGELOG" output=user as-value] -> "data") failur...
by diamuxin
Mon Mar 11, 2024 1:14 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14.1 [stable] is released!

Hi,

Access to CHANGELOG information via CLI does not work:

[admin@MikroTik] > :put ([/tool fetch "https://upgrade.mikrotik.com/7.14.1/CHANGELOG" output=user as-value] -> "data")
failure: Fetch failed with status 404

Thx.
by diamuxin
Sun Mar 10, 2024 8:06 pm
Forum: Scripting
Topic: Feature request: /tool fetch HTTP-POST can send a file
Replies: 23
Views: 17687

Re: Feature request: /tool fetch HTTP-POST can send a file

I send the backup files directly to my FTP server located on my NAS. e.g. /tool fetch address=$ftpserver mode=ftp user=$username password=$password \ src-path=$backupfilename dst-path=$backupfilename upload=yes port=$port; The data is declared in local variables at the beginning of the script. By Te...
by diamuxin
Fri Mar 08, 2024 5:19 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14 [stable] is released!

That a passive peer (without endpoint) constantly tries to perform a handshake, transmitting data to nothing, just because it has a 0.0.0.0.0/0 in the allowed address, which is what is happening. This behavior is irregular, and is a bug to be fixed. SOLVED in 7.15beta6 *) wireguard - do not attempt...
by diamuxin
Sun Mar 03, 2024 11:44 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14 [stable] is released!

You seem to be contradicting yourself. Which one is it? I am not contradicting myself (if you had tried it you would understand). I keep insisting that it makes no sense for the passive peer without endpoint to constantly try to handshake, it's a debugging problem not a wireguard interface problem....
by diamuxin
Sun Mar 03, 2024 10:22 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14 [stable] is released!

Wireguard behavior is not the problem.
The all of a sudden excessive logging is.
This is debug and by default it should be off.
Same with dns, ntp, dhcp... I've seen it all pass by.
Exactly, I think the same.
by diamuxin
Sun Mar 03, 2024 8:37 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14 [stable] is released!

+1 is very, very annoying especially with road-warrior type wireguard connections. Disable wireguard logging and stop bitching. That a passive peer (without endpoint) constantly tries to perform a handshake, transmitting data to nothing, just because it has a 0.0.0.0.0/0 in the allowed address, whi...
by diamuxin
Sat Mar 02, 2024 8:15 pm
Forum: Announcements
Topic: v7.14.3 [stable] is released!
Replies: 670
Views: 258693

Re: v7.14 [stable] is released!

Handshake for peer did not complete after 5 seconds, retrying (try 2) Handshake for peer did not complete after 5 seconds, retrying (try 2) Handshake for peer did not complete after 5 seconds, retrying (try 2) +1, the same by me +1 is very, very annoying especially with road-warrior type wireguard ...
by diamuxin
Sat Feb 17, 2024 11:24 am
Forum: Scripting
Topic: BACKUP Automatic
Replies: 4
Views: 5116

Re: BACKUP Automatic

Another simpler method, for RouterOS 7.10+ versions for backup, sending files to an ftp server, local deletion of files and telegram notification. # ------------------ # Function: Telegram # ------------------ :global tgFunc do={ :do { :local BotToken "XXXXXXXXXX:XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXX...
by diamuxin
Thu Feb 15, 2024 11:32 pm
Forum: Scripting
Topic: BACKUP Automatic
Replies: 4
Views: 5116

Re: BACKUP Automatic

The idea of the script is to take backup with the name of the identity and the current date automatically, so just pasting it on a computer and scheduling a schedule would be guaranteed the copy. I hope you like it and find it useful. I also accept comments to make modifications and see if we can i...
by diamuxin
Tue Jan 30, 2024 3:11 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

I tried to apply this script to CRS with OS version 7.12, but the script sent all the last logs that appeared in CRS and did not select what was written in :local mkwd What do you think is the cause? Run the script from CLI (between {...}) and check if it dumps any errors, the script works fine for...
by diamuxin
Fri Jan 26, 2024 9:44 pm
Forum: Scripting
Topic: Exporting IP addresses from an address-list to a file
Replies: 1
Views: 1889

Re: Exporting IP addresses from an address-list to a file

Can I search for content within a file? /ip firewall address-list :foreach id in=[find list=servers] do={ :local ipAddr [:toip [get $id address]] :local filenameIP "servers100.txt" /file :if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filenameIP &quo...
by diamuxin
Fri Jan 26, 2024 6:24 pm
Forum: Scripting
Topic: Exporting IP addresses from an address-list to a file
Replies: 1
Views: 1889

Exporting IP addresses from an address-list to a file

Hi, I have this script that exports the IP addresses of this list to a file. /ip firewall address-list :foreach id in=[find list=servers] do={ :local ipAddr [:toip [get $id address]] :local filenameIP "servers100.txt" /file :if ([:len [find where name="flash" and type="disk&...
by diamuxin
Thu Jan 25, 2024 10:41 pm
Forum: Scripting
Topic: ✂ Rextended Fragments of Snippets
Replies: 109
Views: 112087

Re: ✂ Rextended Fragments of Snippets

Bad news :(

We will miss your very good scripts (especially your functions) thanks to them I have been able to learn a little more every day.
Thanks for your contribution to the Mikrotik universe.

Best regards.
by diamuxin
Tue Jan 23, 2024 8:50 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 307
Views: 99715

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

I have tried the script you've mentioned with the today released 7.14beta8 version - it still does not work. Is there a possibility to debug a script to see where the error occurs? So far I just removed the "nolog" parameter but the only thing I get is Starting import of address-list: spa...
by diamuxin
Tue Jan 16, 2024 6:29 pm
Forum: Scripting
Topic: Can the content written to the file be added? [SOLVED]
Replies: 17
Views: 8472

Re: Can the content written to the file be added? [SOLVED]

Can multiple results be stored in the same file? Is HTTP or FTP okay? Or can it only be FTP? Can you provide some sample scripts? 1) Yes, you can save several results in the same file: see example in my previous post. 2) I have only tested it by FTP and it works. 3) Example of script using FTP # FT...
by diamuxin
Tue Jan 16, 2024 5:01 pm
Forum: Scripting
Topic: Can the content written to the file be added? [SOLVED]
Replies: 17
Views: 8472

Re: Can the content written to the file be added? [SOLVED]

Thank you for your script example, but this is not what I want. My script loop will produce some results, and my main purpose is to save these results to a file because saving to a file can prevent sudden power outages from time to time. Besides/file set, is there any other good way? I store my sen...
by diamuxin
Tue Jan 16, 2024 11:58 am
Forum: Scripting
Topic: Can the content written to the file be added? [SOLVED]
Replies: 17
Views: 8472

Re: Can the content written to the file be added? [SOLVED]

/system clock :local dt "$[get date] $[get time]" :local filename "datetime.txt" /file :if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filename "flash/$filename"} :if ([:len [find where name=$filename]] = 0) do={print file="...
by diamuxin
Thu Jan 04, 2024 7:24 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

The script I'm using is as per below I've only altered the Bot ID and ChatID. I'm not getting an error so much as the output has been warped as per my last post I get a download link to the telegram API with my BOTID, The message I'm supposed to get is appended at the end aka "Login failure fo...
by diamuxin
Wed Jan 03, 2024 10:21 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Hi folks I hate to ask you but this seems to be the right place, have any of you for some weird reason updated to RouterOS V7.13? I did it against my better judgment and now LogFilter is broken The Logfilter works on another router I have around and it worked on here until I updated from RouterOS 7...
by diamuxin
Mon Jan 01, 2024 1:07 pm
Forum: Scripting
Topic: DynDNS Script from Mikrotik Wiki (correction)
Replies: 33
Views: 43734

Re: DynDNS Script from Mikrotik Wiki (correction)

False... and define what is "latest versions" for you. uff I can't get used to those manners ;-) but I like him... My answer is based on my own experience (when switching to 7.13) and that's why I wanted to help, nothing more. At the time it didn't work with "mode=https" and swi...
by diamuxin
Sun Dec 31, 2023 1:07 pm
Forum: Scripting
Topic: DynDNS Script from Mikrotik Wiki (correction)
Replies: 33
Views: 43734

Re: DynDNS Script from Mikrotik Wiki (correction)

With the latest versions of RouterOS the "fetch" command does not work https anymore.

Image

Try this: (Something similar happened to me with a script)
/tool fetch mode=https \

# change to:

/tool fetch mode=http \
by diamuxin
Sat Dec 30, 2023 8:28 pm
Forum: Announcements
Topic: v7.14beta [testing] is released!
Replies: 498
Views: 189481

Re: v7.14beta [testing] is released!

Ok, thanks.
by diamuxin
Sat Dec 30, 2023 5:07 pm
Forum: Announcements
Topic: v7.14beta [testing] is released!
Replies: 498
Views: 189481

Re: v7.14beta [testing] is released!

do you have a persistent-keepalive configured? that may trigger that log msg also, maybe the logging became more verbose. means, the message always has "been there" but never popped up in the log. cannot verify a) Persistent-keepalive is not configured. b) With "fetch" new messa...
by diamuxin
Sat Dec 30, 2023 3:24 pm
Forum: Announcements
Topic: v7.14beta [testing] is released!
Replies: 498
Views: 189481

Re: v7.14beta [testing] is released!

Hi, When installing the latest beta 7.14beta4 I got these messages on a wireguard road warrior connection, with the stable 7.13 (and earlier) it didn't happen: wg-rw: XN58CdM6ppiSQpDaQT0bh1IMYgUP0czYYY92N1IBwE3c=: Handshake for peer did not complete after 5 seconds, retrying (try 2). When I connect ...
by diamuxin
Mon Dec 25, 2023 6:31 pm
Forum: Scripting
Topic: Script MD5 Hash Generator
Replies: 20
Views: 20370

Re: Script MD5 Hash Generator

Very interesting.. Thanks.
by diamuxin
Wed Dec 20, 2023 8:30 pm
Forum: Scripting
Topic: Netwatch tool + script: Are global variables truly global?
Replies: 28
Views: 15467

Re: Netwatch tool + script: Are global variables truly global?

+1 It would be interesting if we could change the permissions of the *sys user assigned internally to the Netwatch tool, Scheduler or IP DHCP-Server script , for example to allow "policy" to be able to read the content of global variables created by admin or other users. This would make th...
by diamuxin
Wed Dec 20, 2023 11:48 am
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!



/system logging
set 0 disabled=yes
add topics=info,!fetch
I just edited default info rule. Is it correct?

Yes.
You have already added it in the new rule

Image
by diamuxin
Wed Dec 20, 2023 11:37 am
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Hmmm... all my fetch scripts works well without ftp policy. WDIDW?

Also how to disable this new fetch logging?
/system logging
set 0 disabled=yes
add topics=info,!fetch

Image
by diamuxin
Tue Dec 19, 2023 5:39 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

I have several scripts like these (they serve to telegram alert temperature and voltage etc. of the LTE modem) and they no longer work: Try with: :global temp2 :global url "https://192.168.5.2:8443/json.htm?username=mE&ghy&l&password=dGMntyhju&type=command&param=udevice&...
by diamuxin
Tue Dec 19, 2023 4:59 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

is enabled. I get this from the logs: fetch,info,debug Download from https://api.telegram.org/bot42558852236:AAR_pTRe0CjksgfdydhdncbvfdtY4/sendMessage to RAM FAILED: Fetch failed with status 400 My Telegram script works fine in v7.13 :global tgFunc do={ :do { :local BotToken "XXXXXXXXX:XXXXXXX...
by diamuxin
Tue Dec 19, 2023 4:56 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Very interesting...


Image
by diamuxin
Tue Dec 19, 2023 12:55 am
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

If after this you do not understand it open a support ticket with Mikrotik. @diamuxin, you are correct ... I did not fully comprehend the meaning of your comment " You have to delete (uninstall) the existing packages except the "routeros" package, then do the downgrade ." Please...
by diamuxin
Tue Dec 19, 2023 12:34 am
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

My CCR1009 shows under /system/packages routeros wireless I do not see a match under 7.12.1 in the archive Plus why would CCR1009 load a wireless package ? I have explained it to you several times but you don't want to understand. https://forum.mikrotik.com/viewtopic.php?t=202423#p1042842 v7.12.1 P...
by diamuxin
Mon Dec 18, 2023 6:28 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

What process did you follow? 1st step is copy file routeros-7.12.1-tile.npk to Files except I renamed the file like you suggested routeros 2nd step is via terminal issue /system/package/downgrade This did not work The procedure that is outlined in the MikroTiK Docs as follows also did not work for ...
by diamuxin
Mon Dec 18, 2023 5:57 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Hi diamuxin
Your suggested fix did not work for me ...
I did it with an RB4011 and it worked for me.

What process did you follow?
by diamuxin
Mon Dec 18, 2023 5:48 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

they may have changed the address.
> :put ([/tool fetch url="http://upgrade.mikrotik.com/routeros/NEWESTa7.stable" as-value output=user]->"data")
7.13 1702545848
thanks a lot!!
by diamuxin
Mon Dec 18, 2023 5:47 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

I'm still using the script version that extracts the date from change log, not the URL. Seem to be still working just fine. At the moment. But MT could change that too. This is the change: [ ] > :put ([/tool fetch url="http://upgrade.mikrotik.com/routeros/NEWEST a 7.stable" as-value outpu...
by diamuxin
Mon Dec 18, 2023 4:44 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

Use httpS MikroTik is changing the urls for the new v7.10+ versions and also for latest v6: Long term: https://upgrade.mikrotik.com//routeros/NEWEST7.long-term (at time I write: "0.0 \r \n" no long-term version) Stable: https://upgrade.mikrotik.com//routeros/NEWEST7.stable (at time I writ...
by diamuxin
Mon Dec 18, 2023 4:30 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

And still. You HAVE to pass 7.12 or 7.12.1 before you can go up. Maybe I have not explained well, it is not about upgrading, my version before upgrading to 7.13 was version 7.12.1 that I know, that web address I use in some of my scripts to know the last available version 7.X and its upgrade date i...
by diamuxin
Mon Dec 18, 2023 4:25 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

It should report: 7.13 and epoch date: 1702542240 approx. I suspect that URL was used by RouterOS itself to check for new versions. Now that they mandate the 7.12.x to be an intermediate stop on the upgrade path to 7.13 and newer, I believe they introduced a new URL, and the old one will point to t...
by diamuxin
Mon Dec 18, 2023 3:19 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Dear Staff, on hAP ac^2 (and lower) with v7.13 equipment the RAM memory available is ridiculous, 128 MB -> 26 or 28 MB available. I think you should improve the wireless packages so that they don't consume so much.

..
by diamuxin
Mon Dec 18, 2023 3:08 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

on my CCR1009 After upgrade to 7.13 from 7.12.1 when I attempt to downgrade back to 7.12.1 the downgrade fails. Log file shows omitting package system-7.12.1: newer package system-7.13 is already installed I tried 2 methods for the downgrade 1. via terminal 2. via Packages Both return the same resu...
by diamuxin
Mon Dec 18, 2023 3:01 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

AFAIK it will only report 7.12.1 if your current version is below 7.12.1. This is because else the update to 7.13 will likely fail. It makes no sense what you say, if I consult that web address (I use it in my scripts) it has to inform you which is the latest stable version that Mikrotik has, just ...
by diamuxin
Mon Dec 18, 2023 12:53 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Hi, follow this error:

[ ] > :put ([/tool fetch url="https://upgrade.mikrotik.com/routeros/NEWEST7.stable" as-value output=user]->"data")
7.12.1 1700221125

It should report: 7.13 and epoch date: 1702542240 approx.
by diamuxin
Sun Dec 17, 2023 8:39 pm
Forum: Scripting
Topic: reboot - ping down
Replies: 8
Views: 3140

Re: reboot - ping down

In the Netwatch?

# Netwatch (Host tab)
Host: 8.8.8.8
Type: simple
Interval: 00:05:00 
Timeout: 1.00

# Netwatch (Test tab)
:local HOST $host
:local HostStatus [/tool netwatch get value-name=status [find host=$HOST]]
:if ($HostStatus="down") do={/system reboot}
by diamuxin
Sun Dec 17, 2023 8:22 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

small note outside the version. . . hap ax2 if it had at least USB2 (better USB3.X) it would be an ideal small device and I think its sales would increase several times. . . This way we have ac2 with USB but little storage space and limited RAM, and ax2 without USB but with lots of RAM and enough s...
by diamuxin
Sun Dec 17, 2023 2:13 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Hi all! I have the same problem with script on CHR after upgrade :( Download from https://antifilter.download/list/ip.lst to <nothing> FINISHED Download from https://antifilter.download/list/ip.lst to RAM FAILED: Fetch failed with status 206 What can i do with this? https://en.wikipedia.org/wiki/Li...
by diamuxin
Sat Dec 16, 2023 8:03 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Hi all! I have the same problem with script on CHR after upgrade :( Download from https://antifilter.download/list/ip.lst to <nothing> FINISHED Download from https://antifilter.download/list/ip.lst to RAM FAILED: Fetch failed with status 206 What can i do with this? The fetch command has incorporat...
by diamuxin
Sat Dec 16, 2023 6:02 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

+1, report the same error: - fetch with ipv4 url are automatically "translated" into ipv6 by being prefixed with "::ffff:" - This results in either host unreachable or data content = null Had to roll back to 7.12.1 Indeed that is the problem, you have explained it better than me...
by diamuxin
Fri Dec 15, 2023 5:43 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

This AM i upgraded my CCR1009 from version 7.12.1 to version 7.13 now getting the following error when running a script Download from https://view.sentinel.turris.cz/greylist-data/greylist-latest.csv to RAM FAILED: Fetch failed with status 206 The same script was working fine under 7.12.1 and earli...
by diamuxin
Fri Dec 15, 2023 4:52 pm
Forum: Announcements
Topic: v7.13.5 [stable] is released!
Replies: 896
Views: 330795

Re: v7.13 [stable] is released!

Hi friends,

In my script this sequence failed:
[ ] > :put ([/tool fetch url="https://upgrade.mikrotik.com/routeros/NEWEST7.stable" as-value output=user]->"data")
7.12.1 1700221125
It should report: 7.13 and epoch date: 1702542240 approx.
by diamuxin
Tue Dec 05, 2023 2:02 pm
Forum: Scripting
Topic: Send a unicode symbol to Telegram from an array list
Replies: 4
Views: 4954

Re: Send a unicode symbol to Telegram from an array list

Thank you very much Sertik and Amm0 for your help.

By the way Amm0, your site is very useful:
https://observablehq.com/@a2m0/utf2rsc#decodeStart

BR.
by diamuxin
Tue Dec 05, 2023 1:03 am
Forum: Scripting
Topic: Send a unicode symbol to Telegram from an array list
Replies: 4
Views: 4954

Send a unicode symbol to Telegram from an array list

Hi, I would like to know if it is possible based on this code, to insert two (or three) Unicode symbols in a text to send to Telegram, a single symbol if it works fine. # Function $tgFunc by @diamuxin :global tgFunc do={ :local BotToken "XXXXXXXXX:XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXX" :local Ch...
by diamuxin
Sun Dec 03, 2023 5:12 pm
Forum: Scripting
Topic: SSH_Exec command options
Replies: 8
Views: 3281

Re: SSH_Exec command options

I'm not sure if the ConnectTimeout command is supported as there is no mention of it here - https://wiki.mikrotik.com/wiki/Manual:System/SSH_client However if it is supported, would this work? /system ssh-exec connecttimeout=20 address=192.168.88.10 user=root command="shutdown now" This c...
by diamuxin
Sun Dec 03, 2023 5:07 pm
Forum: Scripting
Topic: SSH_Exec command options
Replies: 8
Views: 3281

Re: SSH_Exec command options

the
/delay 30s
doesn't seem to work ?
/delay 30s

Change it to:

:delay 30s
by diamuxin
Sat Dec 02, 2023 12:35 pm
Forum: Scripting
Topic: Foreach syntax
Replies: 5
Views: 3112

Re: Foreach syntax

Good, thanks!
by diamuxin
Fri Dec 01, 2023 4:40 pm
Forum: Scripting
Topic: Foreach syntax
Replies: 5
Views: 3112

Re: Foreach syntax

OK, thanks for the tip @Amm0.

BR.
by diamuxin
Fri Dec 01, 2023 1:50 pm
Forum: Scripting
Topic: Foreach syntax
Replies: 5
Views: 3112

Re: Foreach syntax

Sorry, but after several tests I have already discovered the solution.

{
/interface list
add name=ListB

:delay 1s

/interface/list/member
:foreach i in=[find where ((interface~"ospf") and (list~"ListA"))] do={
    set $i list="ListB"
}
}

by diamuxin
Fri Dec 01, 2023 12:36 pm
Forum: Scripting
Topic: Foreach syntax
Replies: 5
Views: 3112

Foreach syntax

Hi, could you help me with this? It may be silly but I don't know what I'm missing... I want to change the "interface list" of a number of interfaces that contain the word "ospf" and replace ListA with the new ListB. [ ] > interface/list/member pr Columns: LIST, INTERFACE # LIST ...
by diamuxin
Thu Nov 30, 2023 11:58 am
Forum: Scripting
Topic: Send Log to FTP Server
Replies: 4
Views: 2612

Re: Send Log to FTP Server

Hi Tangent,

thanks for your reply.

but i using NAS Synology as FTP Server. There is no Syslog features
I have syslog enabled on the Synology NAS, it is an application called Log Center (Centro de registros in spanish) and it works correctly receiving information from all my mikrotik devices.
by diamuxin
Tue Nov 28, 2023 8:24 pm
Forum: Scripting
Topic: Useful scripts
Replies: 116
Views: 329775

Re: Useful scripts

I was surprised that /user active request-logout is undocumented. Also it's not a request :lol: This one uses the date too. Apparently force logging out a user requires reboot permission for this script to work. It works fine but the active session via Winbox does not disconnect, it only disconnect...
by diamuxin
Thu Nov 23, 2023 8:35 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

Here is my implementation of update script P.S. If somebody want to see code of functions and telegram script used in this script - reply and I'll show you. Very useful your script, thanks. Could you share your $FuncStatus function? A tip: It is not necessary to end each line of code with " ; ...
by diamuxin
Mon Nov 20, 2023 11:28 am
Forum: Scripting
Topic: GPT4 and writing scripts for Mikrotik
Replies: 51
Views: 10108

Re: GPT4 and writing scripts for Mikrotik

ChatGPT search: "mikrotik scripting replace character".

Response:

Image

:regsub ???
:lol: :lol: :lol: :lol:
by diamuxin
Sun Nov 19, 2023 11:16 pm
Forum: Scripting
Topic: No-IP Updater Scripting
Replies: 3
Views: 10607

Re: No-IP Updater Scripting

Example of noip script without global variables (simpler). # Data to be modified :local noipuser "username" :local noippass "MyStr0ngPassWoRd!" :local noiphost "mydomain.sytes.net" # From now on, do not modify :local cIP [/ip cloud get public-address] :if ([:resolve $no...
by diamuxin
Sat Nov 18, 2023 12:42 pm
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

Ok I understand. The data comes from computers INSIDE my LAN. They are not external data. I'm careful with that evidently,
But thanks for the advice.
by diamuxin
Sat Nov 18, 2023 12:08 am
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

The data used is for learning use only.
by diamuxin
Fri Nov 17, 2023 7:54 pm
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

For convert x|y|z on one array of 3 elements, two way are simpler: first replace inside the string all | with , and use :toarray or use a "while" until you do not process the string from the start to the end and create a new string inside the array fore each | and the last at the end of t...
by diamuxin
Fri Nov 17, 2023 7:28 pm
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

Thank you all for your advice.

BR.
by diamuxin
Fri Nov 17, 2023 3:30 pm
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

Is just an example for a little complex string, if the fields are more, a cycle is better... What would be the way to do it without pick? I have tried as an array but only "the comma" works as a separator between values. The vertical bar does not work. { :local test [:toarray "081234...
by diamuxin
Tue Nov 14, 2023 1:53 pm
Forum: Scripting
Topic: Use fetch wil create the File
Replies: 8
Views: 2853

Re: Use fetch wil create the File

:lol: :lol:
by diamuxin
Thu Nov 09, 2023 1:51 am
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

A little difficult but with your excellent explanation I understand.
Thank you magister!
by diamuxin
Thu Nov 09, 2023 1:00 am
Forum: Scripting
Topic: Splitting/parsing variable data [SOLVED]
Replies: 21
Views: 23823

Re: Splitting/parsing variable data [SOLVED]

{ :local test "081234567890|West Java|John Due" :put [:pick $test 0 [:find $test "|" -1] ] :put [:pick $test ([:find $test "|" -1] + 1) [:find $test "|" [:find $test "|" -1]] ] :put [:pick $test ([:find $test "|" [:find $test "|"...
by diamuxin
Sun Oct 29, 2023 5:35 pm
Forum: Scripting
Topic: script to calculate next date [SOLVED]
Replies: 16
Views: 17881

Re: script to calculate next date [SOLVED]

Another way to do it (based on @rextended functions) :global unixtodatetime do={ :local ux [:tonum $1] :local Fzerofill do={:return [:pick (100 + $1) 1 3]} :local prMntDays [:toarray "0,0,31,59,90,120,151,181,212,243,273,304,334"] :local vgmt [:tonum [/system clock get gmt-offset]]; :if ($...
by diamuxin
Tue Oct 17, 2023 9:20 pm
Forum: Announcements
Topic: v7.12rc is released!
Replies: 224
Views: 120056

Re: v7.12rc is released!

Sorry about that. Changelogs are fixed now.
It's perfect now, thank you very much.

BR.
by diamuxin
Tue Oct 17, 2023 7:40 pm
Forum: Announcements
Topic: v7.12rc is released!
Replies: 224
Views: 120056

Re: v7.12rc is released!

In the following link (which I use in my scripts) the correct content of the Changelog is not updated, it only reports the previous version 7.12rc1 Use the correct URLs... https://forum.mikrotik.com/viewtopic.php?t=200103#p1030161 https://upgrade.mikrotik.com//routeros/NEWEST7.testing 7.12rc2 16974...
by diamuxin
Tue Oct 17, 2023 6:54 pm
Forum: Announcements
Topic: v7.12rc is released!
Replies: 224
Views: 120056

Re: v7.12rc is released!

In the following link (which I use in my scripts) the correct content of the Changelog is not updated, it only reports the previous version 7.12rc1 https://upgrade.mikrotik.com/routeros/ 7.12rc2 /CHANGELOG Please, can you check it? What's new in 7.12rc1 (2023-Oct-05 08:46): Changes in this release: ...
by diamuxin
Tue Oct 17, 2023 12:27 pm
Forum: Scripting
Topic: Best Script Editor for RouterOS?
Replies: 4
Views: 3927

Re: Best Script Editor for RouterOS?

I use Visual Studio Code with the "RouterOS Syntax Highlighting" extension installed.

Image
by diamuxin
Mon Oct 16, 2023 2:29 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

And about [/system clock get gmt-offset], the correct way to use it is how is used inside my script... (until mikrotik do not fix something...) OK, very helpful { :local vgmt [/system clock get gmt-offset] :if ($vgmt > 0x7FFFFFFF) do={:set vgmt ($vgmt - 0x100000000)} :if ($vgmt < 0) do={:set vgmt (...
by diamuxin
Sun Oct 15, 2023 10:43 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

Now I understand, it's because of the time difference in my country: GMT +2 (summer time). My router is set like this. Thanks. Possible fix?: :local currEpoch :if ([/system clock get gmt-offset] = 7200) do={ # Summer time. GMT Offset +02:00 :set currEpoch ([$datetime2epoch [/system/package get [find...
by diamuxin
Sun Oct 15, 2023 10:33 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

Hi @rextended, I have detected a small discrepancy: the EPOCH calculations performed by MikroTik are different from the calculations performed by your $datetime2epoch function, what do you think? :global datetime2epoch do={ :local dtime [:tostr $1] /system clock :local cyear [get date] ; :if ($cyear...
by diamuxin
Fri Oct 13, 2023 12:56 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

Much better this way. Nice! One question: Is it only applicable to the "stable" version? https://upgrade.mikrotik.com/routeros/LATEST.7 I have another script to control the "testing" version (I use the extraction of the build date from the changelog), do you know if it is possibl...
by diamuxin
Fri Oct 13, 2023 12:38 am
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

This way, I have tested it and it works OK. I hope it helps. The $datetime2epoch and $date2ymd functions should already be in memory. /system package update; check-for-updates without-paging as-value; :delay 3s :global datetime2epoch :global date2ymd :local LatestVer [get latest-version] :local Stat...
by diamuxin
Thu Oct 12, 2023 6:22 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

I think the script is not well designed. In this part: :if ($DSR <= $DaysToWait) do={ :log info "~~~~~~~~~ New RouterOS release is out for $DSR so NOT updating this device until release has been out for $DaysToWait days ~~~~~~~~~~~~~~~~" :set $DaysSinceRelease $newdays; /file set "Day...
by diamuxin
Wed Oct 11, 2023 5:44 pm
Forum: Scripting
Topic: I did it! Script to compute UNIX time!
Replies: 36
Views: 32046

Re: I did it! Script to compute UNIX time!

:local A [$datetime2epoch "2023-09-30 16:55"] 1696085700 :local B [$datetime2epoch "2023-08-31 16:55"] 1693493700 Result: A - B / 86400 = 30 days Note: The converter to change the Changelog date to the MT date can be found at: https://forum.mikrotik.com/viewtopic.php?t=200103#p1...
by diamuxin
Wed Oct 11, 2023 5:20 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

Trouble is the date format in the changelog is different than that in the router "2023-Aug-31 16:55" has to be converted to "2023-08-31 16:55" found a script from @rextended to convert to epoch to do the math but even that does not like the "Aug" format. the datetime2e...
by diamuxin
Wed Oct 11, 2023 1:43 am
Forum: Scripting
Topic: invalid internal item number [SOLVED]
Replies: 13
Views: 9963

Re: invalid internal item number [SOLVED]

With this script I have the same error: "invalid internal item number". It works on a hAP ac^2 and does not work on a RB4011. Both with v7.11.2. :local output :local filename :local sysname [/system identity get name] :set filename ($"sysname"."-"."Leases.txt"...
by diamuxin
Fri Oct 06, 2023 10:07 pm
Forum: Scripting
Topic: I did it! Script to compute UNIX time!
Replies: 36
Views: 32046

Re: I did it! Script to compute UNIX time!

I think I have found the solution, before the next local variable in the code of @rextended https://forum.mikrotik.com/viewtopic.php?p=1029048#p994849 :local yyyy [:pick $vdate ($vdoff->0) ($vdoff->1)] ; :if (((($yyyyy - 1968) % 4) = 0) do={:set ($arrm->1) -1; :set ($arrm->2) 30} Add this code snipp...
by diamuxin
Fri Oct 06, 2023 9:40 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

There would be a solution to get the build date: /system package update :local latest [get latest-version] :local changeLog ([/tool fetch "http://upgrade.mikrotik.com/routeros/$latest/CHANGELOG" output=user as-value] -> "data") :local dateEx [:pick $changeLog ([:find $changeLog &...
by diamuxin
Fri Oct 06, 2023 8:08 pm
Forum: Scripting
Topic: I did it! Script to compute UNIX time!
Replies: 36
Views: 32046

Re: I did it! Script to compute UNIX time!

Hi Rex ! For your super-function "datetime2epoch" how could we adapt the following date? 2023-Aug-31 16:55 It is to extract the date from a changelog that comes with a somewhat peculiar format (Mikrotik has not yet unified the dates to ISO 8601). What's new in 7.11.2 ( 2023-Aug-31 16:55 ):...
by diamuxin
Fri Oct 06, 2023 2:34 pm
Forum: Scripting
Topic: Script to update RouterOS after X days of release
Replies: 51
Views: 15944

Re: Script to update RouterOS after X days of release

that also returns the build date? When executing the command: :put [/system/package/update/ get] channel=stable;installed-version=7.11.2;latest-version=7.11.2;status=System is already up to date No compilation date available, I have only seen it in the changelog itself: What's new in 7.11.2 ( 2023-...
by diamuxin
Wed Oct 04, 2023 10:01 pm
Forum: Scripting
Topic: Compare RouterOS version in script
Replies: 9
Views: 4656

Re: Compare RouterOS version in script

I have a function that converts the version to a numerical value: https://git.eworm.de/cgit/routeros-scripts/tree/global-functions.rsc?id=9069f71ee6168a651fd42f90b7aea309fefa260b#n1269 [admin@MikroTik] > :put [ $VersionToNum 7.9 ] 118095616 [admin@MikroTik] > :put [ $VersionToNum 7.10beta5 ] 118120...
by diamuxin
Tue Oct 03, 2023 12:59 am
Forum: Scripting
Topic: Script to check for new developer versions [SOLVED]
Replies: 2
Views: 4904

Re: Script to check for new developer versions [SOLVED]

try requesting 2 times with a delay
:local latest [/system package update get latest-version]
:delay 1
:set latest [/system package update get latest-version]
sometimes it returns empty value or check for empty value
Ok thanks, this way it seems that it has not given error again.
by diamuxin
Sun Oct 01, 2023 8:50 pm
Forum: Scripting
Topic: Script to check for new developer versions [SOLVED]
Replies: 2
Views: 4904

Script to check for new developer versions [SOLVED]

Hi, I have created this script to inform me about new testing versions, but sometimes I get an error: failure: closing connection: <404 Not Found> 159.148.172.226:80 (4) And sometimes it works fine. Do you see any error in the code? thanks. :global prev "" :local ch [/system package update...
by diamuxin
Wed Sep 13, 2023 11:53 pm
Forum: Beginner Basics
Topic: Documentation for CLI follow, follow-only and follow-strict
Replies: 8
Views: 3562

Re: Documentation for CLI follow, follow-only and follow-strict

Indeed, follow-strict does not add any thing different than print already do. It might be interesting to replace it with a option to limited the number of lines shown, beginning from last. follow-last=10 -> shows the last ten lines (.id) from the otherwise printed text. See here for an example for ...
by diamuxin
Sat Sep 09, 2023 11:37 pm
Forum: Scripting
Topic: New command in RouterOs 7
Replies: 37
Views: 18007

Re: New command in RouterOs 7

A great masterclass!
Thank you very much for helping me to understand it.

BR.
by diamuxin
Sat Sep 09, 2023 9:37 pm
Forum: Scripting
Topic: New command in RouterOs 7
Replies: 37
Views: 18007

Re: New command in RouterOs 7

So, to keep it short, if I just want to get information about a specific command, for example "/ip/firewall", it would be something like this? :put [/console/inspect as-value request=syntax path="/ip/firewall/"] I've tried it and it doesn't work Can you give me an example please?...
by diamuxin
Sat Sep 09, 2023 9:13 pm
Forum: Scripting
Topic: New command in RouterOs 7
Replies: 37
Views: 18007

Re: New command in RouterOs 7

/console/inspect - this is an "easter egg" – but I have an partial example of usage here: https://forum.mikrotik.com/viewtopic.php?t=175564&hilit=%2Fconsole%2Finspect#p966543 Hi @Amm0, Is it possible to dump the command list (/console/inspect) in a file for future reference? Thanks.
by diamuxin
Thu Sep 07, 2023 11:57 pm
Forum: Scripting
Topic: DHCP-Client script not working [SOLVED]
Replies: 7
Views: 4829

Re: DHCP-Client script not working [SOLVED]

Rex, In the tests you have performed and from what you have opened the other thread in the General forum, how did you create the user *sys ? it would be like the linux "root" user, right ? You tell me that the DHCP-Server script uses this *sys user, so if you have the highest rights, why d...
by diamuxin
Thu Sep 07, 2023 6:27 pm
Forum: Scripting
Topic: DHCP-Client script not working [SOLVED]
Replies: 7
Views: 4829

Re: DHCP-Client script not working [SOLVED]

Thanks Rex, for your escalation of this issue.

BR.
by diamuxin
Wed Sep 06, 2023 7:54 pm
Forum: Scripting
Topic: DHCP-Client script not working [SOLVED]
Replies: 7
Views: 4829

Re: DHCP-Client script not working [SOLVED]

Hi, I have found a solution to the problem of using the ssh-exec command from the lease script tab of the dhcp-server since it seems that from this part it does not use the RSA keys assigned to the administrator user (possible bug?). 1. Create a Scheduler task with the following content: (runs with ...
by diamuxin
Sun Sep 03, 2023 11:55 am
Forum: Scripting
Topic: DHCP-Client script not working [SOLVED]
Replies: 7
Views: 4829

Re: DHCP-Client script not working [SOLVED]

Apparently nothing wrong...
Probably dhcp script have less right than "normal script"...
Maybe you are right Rex, that it is a problem of execution permissions when it involves executing a command on another mikrotik (via SSH with RSA keys).

Thanks.
by diamuxin
Sat Sep 02, 2023 2:10 pm
Forum: Scripting
Topic: DHCP-Client script not working [SOLVED]
Replies: 7
Views: 4829

DHCP-Client script not working [SOLVED]

Hi, I am trying this script to report each lease of my DHCP server (RB4011) but there is some problem in the "ether4" part as I don't get the AP information. :if ($leaseBound = 1) do={ :do { /ip dhcp-server lease :local Comment [get value-name=comment number=[find address=$leaseActIP]] /in...
by diamuxin
Sat Sep 02, 2023 12:14 am
Forum: Scripting
Topic: Script to release/renew WAN IP when offline? [SOLVED]
Replies: 5
Views: 4371

Re: Script to release/renew WAN IP when offline? [SOLVED]

I am not running pppoe client. My ether2 is WAN. Where do you get the WAN IP? Check IP > DHCP-Client to see if "ether2" appears. Try: :if ([/ping 1.1.1.1 count=6] = 0) do={/ip dhcp-client release [find interface=ether2]} :delay 2s :if ([/ping 1.1.1.1 count=6] = 0) do={/ip dhcp-client rene...
by diamuxin
Fri Sep 01, 2023 1:00 am
Forum: Scripting
Topic: Script to release/renew WAN IP when offline? [SOLVED]
Replies: 5
Views: 4371

Re: Script to release/renew WAN IP when offline? [SOLVED]

Something like this might work for you. { :if ([/ping 8.8.8.8 interval=500ms count=10]<8) do={ :log error "Warning: no internet connection. Reconnecting..."; # Reset WAN interface. e.g. "pppoe-out1" interface /interface/pppoe-client/disable 0 :delay 5s /interface/pppoe-client/ena...
by diamuxin
Tue Aug 29, 2023 9:42 am
Forum: Scripting
Topic: Automatic Config Backup --> Not working in December
Replies: 7
Views: 3721

Re: Automatic Config Backup --> Not working in December

share your backup script so they can help you...
by diamuxin
Fri Aug 25, 2023 9:20 pm
Forum: Scripting
Topic: Voltage Monitoring in ROS v.7 and send message to TELEGRAM [SOLVED]
Replies: 14
Views: 19342

Re: Voltage Monitoring in ROS v.7 and send message to TELEGRAM [SOLVED]

how to set text in the telegram message as BOLD FONT in the script??? In your code: :local emessage ($thisbox . " !!!_POWER is UP_!!! - current voltage is: " . [:pick $voltage 0 2] . "." . [:pick $voltage 2 3]) use HTML code for bold type: <b>text</b> Example: :local emessage ($...
by diamuxin
Wed Aug 16, 2023 12:21 pm
Forum: Announcements
Topic: v7.11.2 [stable] is released!
Replies: 348
Views: 192043

Re: v7.11 [stable] is released!

usually that error is firewall problem, try allowing UDP "5246,5247" on input chain on your bidge side and see if fixes it on v.7.11
But CAPSMAN has always worked fine with v7.10 without the need to open ports 5246 and 5247, I understand that internally CAPSMAN already enables them.
by diamuxin
Wed Aug 16, 2023 10:46 am
Forum: Announcements
Topic: v7.11.2 [stable] is released!
Replies: 348
Views: 192043

Re: v7.11 [stable] is released!

Hi,

Issues with CAPSMAN on a RB4011 router, error type "removing stale connection". Back to version v7.10 and OK.

BR.
by diamuxin
Mon Aug 14, 2023 8:50 pm
Forum: Scripting
Topic: Voltage Monitoring in ROS v.7 and send message to TELEGRAM [SOLVED]
Replies: 14
Views: 19342

Re: Voltage Monitoring in ROS v.7 and send message to TELEGRAM [SOLVED]

Simpler script without using so many global variables. /system health :local tempSystem [:tonum ([get [find where name=temperature]]->"value")] :local voltSystem ([get [find where name=voltage]]->"value") :local tempMax 55 :local voltMin 20 # Check Temperature :if ($tempSystem >=...
by diamuxin
Mon Aug 14, 2023 8:07 pm
Forum: Scripting
Topic: Voltage Monitoring in ROS v.7 and send message to TELEGRAM [SOLVED]
Replies: 14
Views: 19342

Re: Voltage Monitoring in ROS v.7 and send message to TELEGRAM [SOLVED]

I am now trying to run this same script on the latest firmware (7.10.2) and it is not running at all.
Where I have problem?
change this:
:local voltage [/system health get voltage]
by:
:local voltage [/system health get [find name=voltage] value]
by diamuxin
Sun Aug 13, 2023 1:54 pm
Forum: Scripting
Topic: Disconnect wireguard vpn when it has been inactive for a long time
Replies: 0
Views: 2244

Disconnect wireguard vpn when it has been inactive for a long time

Hello!

Is it possible to create a script for wireguard type roadwarrior to disconnect the vpn when it has been inactive for more than X minutes?

BR.
by diamuxin
Thu Aug 10, 2023 7:47 pm
Forum: Scripting
Topic: BACKUP INTERFACE [SOLVED]
Replies: 6
Views: 3764

Re: BACKUP INTERFACE [SOLVED]

You don't need a complex script to switch from ISP1 to ISP2 and vice versa, with a simple Failover with recursive routes you have it solved, I have it (Fiber + LTE) and it works very well. Luck.
by diamuxin
Thu Aug 10, 2023 7:00 pm
Forum: Scripting
Topic: BACKUP INTERFACE [SOLVED]
Replies: 6
Views: 3764

Re: BACKUP INTERFACE [SOLVED]

by diamuxin
Thu Aug 10, 2023 4:57 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

According to error code 100005 it corresponds to "ERROR_FORMAT_ERROR". Also, the date format you have is the one before v7.10 (aug/09/2023). I would try a version >=v7.10 where the date comes with the international ISO 8601 format (2023-08-09) which matches the date format of the Huawei mo...
by diamuxin
Thu Aug 10, 2023 12:36 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

Hi, I have RouterOS v7.10 and it works correctly both ways: @diamuxin :global sendSMS do={ # Example: # :put [$sendSMS lteIP="192.168.8.1" phone="+34XXXXXXXXX" sms="test sms via lte api"] :local lteIP "192.168.8.1" :global tokenParser # get SessionID and Token...
by diamuxin
Wed Aug 02, 2023 3:34 pm
Forum: Scripting
Topic: find addresses with same octets
Replies: 39
Views: 6426

Re: find addresses with same octets

I solved the speed problem...

Fake24 aggregator, now is really fast...
This script, what does it really do?
can you give an example to understand it? thanks.
by diamuxin
Mon Jul 31, 2023 12:44 pm
Forum: Scripting
Topic: Script to find the day of the week eg sun,mon,tue etc
Replies: 17
Views: 7286

Re: Script to find the day of the week eg sun,mon,tue etc

Full version of the @rextended script:

viewtopic.php?t=191520#p1010947

BR.
by diamuxin
Wed Jul 26, 2023 10:32 am
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

New TIP: Change DHCP server IP address range (modem) to be able to configure a single IP for the Mikrotik DHCP client. 1. Run the following script to create the global variable dhcpSMS . 2. From the Terminal type: :put [$dhcpSMS lteIP="192.168.8.1" startIP="192.168.8.100" endIP=...
by diamuxin
Tue Jul 25, 2023 3:33 pm
Forum: Scripting
Topic: send MikroTik Notification via WhatsApp
Replies: 55
Views: 48660

Re: send MikroTik Notification via WhatsApp

Using third-party applications or scripts linked into the MikroTik RouterOS, it is possible to send MikroTik alerts through WhatsApp. This increases the effectiveness of network administration and monitoring by allowing administrators to simply receive important information on their cellphones. ano...
by diamuxin
Fri Jul 07, 2023 10:40 pm
Forum: Scripting
Topic: block IP by login failure
Replies: 11
Views: 8483

Re: block IP by login failure

I think that's right, isn't it?
On the moment I can not test it, but apparently it is correct...
Works OK.

The local variables $userinside and $intinside I have eliminated them because I have not seen any use in the script.

Thanks.
by diamuxin
Fri Jul 07, 2023 3:03 am
Forum: Scripting
Topic: block IP by login failure
Replies: 11
Views: 8483

Re: block IP by login failure

This script save the last checked log for start from that point instead to elaborate all list everytime: https://forum.mikrotik.com/viewtopic.php?p=1004552#p1004546 I think that's right, isn't it? # Check if exist drop firewall rule and add /ip firewall raw :if ([:len [find where src-address-list=&...
by diamuxin
Thu Jul 06, 2023 6:34 pm
Forum: Scripting
Topic: block IP by login failure
Replies: 11
Views: 8483

Re: block IP by login failure


And once the ip of the variable "$ipinside" is blocked in the address list, how can I delete all the lines in the log that contain that IP?
by diamuxin
Thu Jul 06, 2023 5:12 pm
Forum: Scripting
Topic: block IP by login failure
Replies: 11
Views: 8483

Re: block IP by login failure

Is this?

viewtopic.php?p=929454&hilit=login+failure#p929454

EDIT:
Can you add it to your post "✂ Rextended Fragments of Snippets"?
so it doesn't get lost!!! hehe
by diamuxin
Thu Jul 06, 2023 3:56 pm
Forum: Scripting
Topic: block IP by login failure
Replies: 11
Views: 8483

Re: block IP by login failure

I read somewhere on the forum a similar script already working.
OK, I will look for it
by diamuxin
Thu Jul 06, 2023 3:47 pm
Forum: Scripting
Topic: block IP by login failure
Replies: 11
Views: 8483

block IP by login failure

Hi, I have had several attempts to access from the same IP in the Local Network 192.168.1.134 and to all the services of the router (ssh, telnet and ftp), luckily it has not been able to access since I changed user and password at the time. 07-05 13:10:54 system,error,critical login failure for user...
by diamuxin
Sun Jul 02, 2023 2:02 pm
Forum: Scripting
Topic: Date Parts --> Weekday? [SOLVED]
Replies: 11
Views: 6377

Re: Date Parts --> Weekday? [SOLVED]

Oh, very complete. Thanks Rex!!
Happy summer!
by diamuxin
Sun Jul 02, 2023 2:35 am
Forum: Scripting
Topic: Date Parts --> Weekday? [SOLVED]
Replies: 11
Views: 6377

Re: Date Parts --> Weekday? [SOLVED]

Hi @rextended, Since the release of ROS v7.10 the date changed to 2023-07-02 format. So this function should change the months array, right? Would it be something like this? /system clock :local strDate [get date] :local intYear [:pick $strDate 0 4] :local strMonth [:pick $strDate 5 7] :local intDay...
by diamuxin
Fri Jun 30, 2023 1:14 am
Forum: Scripting
Topic: check if file exists?
Replies: 15
Views: 18316

Re: check if file exists?

Similarly, is it possible to check whether a folder exists? I want to check if /flash/ exists or not before doing my stuff (some cards have it, other don't). The solution is in the previous post (thanks to @rextended), try to adapt it to your needs. :global subdir "flash" :global findresu...
by diamuxin
Thu Jun 29, 2023 4:19 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

I am working (in my very limited spare time) in a more powerful library for HiLink access in RouterOS scripts that will try to solve these problems, call a function when new sms arrives, and even implements automatic execution of RoS scripts when receiving sms with :cmd, as Mikrotik's own SMS suppo...
by diamuxin
Tue Jun 27, 2023 11:03 am
Forum: Scripting
Topic: Script is executed twice from Scheduler
Replies: 6
Views: 2515

Re: Script is executed twice from Scheduler

Strange, in the end it was solved by deleting and recreating the Scheduler tasks. The events have not recurred. :shock:

Thank you.
by diamuxin
Mon Jun 26, 2023 2:58 pm
Forum: Scripting
Topic: Script is executed twice from Scheduler
Replies: 6
Views: 2515

Re: Script is executed twice from Scheduler

Uhm... again timezone? Try to schedule the event at 03:00...
Okay, I'll try it tonight. Thank you.

BR.
by diamuxin
Mon Jun 26, 2023 2:45 pm
Forum: Scripting
Topic: Script is executed twice from Scheduler
Replies: 6
Views: 2515

Re: Script is executed twice from Scheduler

(export of both scheduler and script?) Of course: (For example for the "backups" script) /system scheduler add interval=1d name=backups on-event="/system/script/run backups" policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-date=2022-05-01 start-t...
by diamuxin
Sun Jun 25, 2023 9:01 pm
Forum: Scripting
Topic: Script is executed twice from Scheduler
Replies: 6
Views: 2515

Script is executed twice from Scheduler

Hello,

I have a problem that I don't understand, my RB750Gr3 router executes twice in a row each script scheduled from scheduler (it should only do it once).

The rest of the Mikrotik routers everything goes fine.

Has anyone had the same problem?

Thanks.
by diamuxin
Thu Jun 22, 2023 1:21 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

@rextended already makes us happy with impressive contributions, he doesn't need to work any more :lol:
by diamuxin
Mon Jun 12, 2023 6:26 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Adding "..." as suggested by @diamuxin will add "..." also to shorter messages (don't know if this was clear...) I don't understand you, messages of < 30 characters will always be visible, they are not cut (tested) they are only cut > 30 characters. The lines 2, 3 or 4 that you ...
by diamuxin
Mon Jun 12, 2023 12:28 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Excellent @rextended, shockingly easy and works! Now, in a perfect world text with more that 30 characters should have "..." at the end and shorter not. I'll try to scratch my head but if you have an hint to point in the right direction... :) I don't really understand the point of cutting...
by diamuxin
Tue May 30, 2023 9:04 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Both scripts are updated for:
EDIT x: Exclude on default ipsec error messages phase1 negotiation failed, added the possibility to exclude topics regardless are critical or error or warning
(thanks to @S8T8 for the idea)
Updated! thx

..
by diamuxin
Mon May 29, 2023 2:15 pm
Forum: Scripting
Topic: Script to disable interface when there is no traffic
Replies: 3
Views: 2285

Re: Script to disable interface when there is no traffic

Friends, I need a script to disable an interface of my RB when it has no traffic. and after a few seconds that interface is re-enabled. Thank you for your cooperation.
Maybe this can help:
viewtopic.php?t=104841#p521331
by diamuxin
Sun May 28, 2023 2:28 am
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Impressive work Rex, thank you very much, really. Thanks, I hope is error free . I do not have Telegram, but the URL "text" is correctly generated. If you ignore the date conversion and the correct urlencode, are less lines of code for do the same thing... ;) I confirm that your script wo...
by diamuxin
Sat May 27, 2023 2:39 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Impressive work Rex, thank you very much, really.

I'm away with the family right now, I'll try it as soon as I can.

BR.
by diamuxin
Sat May 27, 2023 11:16 am
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

try to set the device to GMT +00:00...... (and disable auto-detect) Good morning, I have already performed the tests with the following conditions: a) Configured System > Clock - Time: Local time - Date: Current date - Time Zone Autodetected: Unchecked - Time Zone Name: GMT+0 b) System > NTP Server...
by diamuxin
Fri May 26, 2023 8:43 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

try to set the device to GMT +00:00...... (and disable auto-detect)
Ok, I'll do the test tonight.

..
by diamuxin
Fri May 26, 2023 1:02 am
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Nothing, the same problem persists.
:(
by diamuxin
Thu May 25, 2023 6:06 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

yes, I uncommented it and save to a global variable, but the result is the same. In your opinion, changing the rules of the date and updated to 7.10 with the new ISO format of the date, could it be solved? On a Miktotik with v7.9.1 I tried tonight to leave the date format of the original script: ma...
by diamuxin
Thu May 25, 2023 10:22 am
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Well, the test performed tonight with the original script has been failed, some events of the previous day have been repeated tonight at 00:00 and 02:00.

I think the problem then cannot be the date. I don't know where it fails.
by diamuxin
Wed May 24, 2023 5:27 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

Hello again, I have tested this code (original script) without any modification (only Telegram token and chat_id) and made a simulation by setting the router time to 23:58:00. When reaching 00:00:00:00 no event from the previous day has been repeated, it has worked as expected. @abbio90, try with th...
by diamuxin
Wed May 24, 2023 5:24 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

ipsec script was copied from this one i found on github. so by copying I also copied the errors. I'll try to change this. more than anything I don't understand how to solve the continuous sending of messages at 00:00 and 02:00 My time zone is the same as Italy (from Spain) and the times previously ...
by diamuxin
Wed May 24, 2023 2:37 pm
Forum: Scripting
Topic: Log Filter
Replies: 66
Views: 14565

Re: Log Filter

It works perfectly, but every day at 00:00 and 02:00, I get the latest notification of the day. My script is the same base as yours, but adapted to my needs, https://forum.mikrotik.com/viewtopic.php?t=151953#p1003030 I have the same problem you mentioned: It repeats events of the previous day, same...
by diamuxin
Wed May 24, 2023 1:08 pm
Forum: Scripting
Topic: Persistent Environment Variables [SOLVED]
Replies: 60
Views: 55793

Re: Persistent Environment Variables [SOLVED]

Yes, but the function work? Is easy copy & paste the "eval / evl" code, but is restored just as string... on the code is present: :if ($vvalue~"\\(eval|evl) ") do={:set vvalue "(function)"} is missing one (another) ( before eval, now the script is fixed You are rig...
by diamuxin
Wed May 24, 2023 12:20 pm
Forum: Scripting
Topic: Persistent Environment Variables [SOLVED]
Replies: 60
Views: 55793

Re: Persistent Environment Variables [SOLVED]

Check twice.... after reboot....

If the function is
:global f do={ /interface print }

It's normal this:
:put [$f]
(function)

Is just a text "(function)" or another script set again the function correctly...
look at the screenshots

..
by diamuxin
Wed May 24, 2023 12:08 pm
Forum: Scripting
Topic: Persistent Environment Variables [SOLVED]
Replies: 60
Views: 55793

Re: Persistent Environment Variables [SOLVED]

[…] it is now possible to save/restore the content of a function. Congratulations! EEEEEEEHHHHHHHHHHHHH??????????? I am going to capture screenshots, just a second -------- Ready: a) Backup to Layer7 https://www.dropbox.com/s/qog0dyp1cz4f87s/BH1Bkh6LhS.png?dl=1 b) Restore to Environment https://www...
by diamuxin
Wed May 24, 2023 11:57 am
Forum: Scripting
Topic: Persistent Environment Variables [SOLVED]
Replies: 60
Views: 55793

Re: Persistent Environment Variables [SOLVED]

You try the "new version" if do same error?
Hi Rex,

Sorry for the delay, I just tested both scripts and they are now working correctly, both in v7.9.1 and v10beta5.

I am also happy because I see that it is now possible to save/restore the content of a function. Congratulations!

BR.
by diamuxin
Tue May 23, 2023 5:55 pm
Forum: Scripting
Topic: Persistent Environment Variables [SOLVED]
Replies: 60
Views: 55793

Re: Persistent Environment Variables [SOLVED]

Hi rextended, when I run your first script to save the global variables I get an error: ROS Version 7.9.1 [admin@MikroTik] > sys scr run save-global-variables failure: bad regexp: unmatched () ROS Version 7.10beta5 [admin@MikroTik] > sys scr run save-global-variables failure: bad regexp: too many ()...
by diamuxin
Fri May 19, 2023 7:18 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

You have thested the last script?
wow! now it's working!
now works on both systems, v7.9 and v7.10

thanks for everything!!!
by diamuxin
Fri May 19, 2023 3:28 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

ok, no problem.

BR.
by diamuxin
Fri May 19, 2023 2:56 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

Can be a bug, I check.

Failed tests in these cases:
(v7.10beta5)
:put [$anydate2isodate "apr/22 16:33:41"]; # -19 -04-22 6:33:41
:put [$anydate2isodate "Apr/22 16:33:41"]; # -19 -04-22 6:33:41
:put [$anydate2isodate "04-22 16:33:41"]; # -19--4--2 6:33:41

thanks.
by diamuxin
Fri May 19, 2023 2:37 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

Hi Rex, I think I have detected a bug? in the script:

:put [$anydate2isodate "04-22 16:33:41"]

In v.7.9 output
2023-04-22 16:33:41

In v7.10beta5 output:
-19--4--2 6:33:41

Is it normal?

EDIT post: changing the order of the date. Sorry.
..
by diamuxin
Fri May 19, 2023 1:12 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

Brillante!. Grazie.
Works great.

I'm sorry the comment confused you.

BR.
by diamuxin
Fri May 19, 2023 12:44 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

Rex, the approach of the script is fine because the Log lines of less than 24h do not have the date, only the time: :if ([:len $currentTime] = 8 ) Log e.g. 02:07:19 script,info Automated Cloud Backup Completed The script completes that line by incorporating the "current" date of the actual...
by diamuxin
Fri May 19, 2023 12:28 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

I'm preparing the script for you to see, it takes a while because I'm at work now.
Oh thanks, no problem.
by diamuxin
Fri May 19, 2023 12:21 pm
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

add $currentTime to log that repost only the date is wrong, must be 00:00:00 add the scheduler using old format value probably is unsupported, if not on 10beta5, on new versions. The tests are done on a hAP ac^2 with v7.10beta5. But now I want it to be valid for versions <7.10 I assume you are refe...
by diamuxin
Fri May 19, 2023 10:30 am
Forum: Scripting
Topic: Monitor Mikrotik log by Telegram
Replies: 65
Views: 44979

Re: Monitor Mikrotik log by Telegram

Hi, I am trying to adapt this script to be compatible with the new ISO date format of v7.10+. Could the "LOG DATE" part of the code be made shorter? # LOG DATE # format daily 00:00:00 :if ([:len $currentTime] = 8 ) do={ # format $date 2023-05-17 (10) :if ([:len $date] = 10) do={ :set curre...
by diamuxin
Mon Apr 24, 2023 11:50 am
Forum: Scripting
Topic: Check Wireguard tunnel
Replies: 6
Views: 5144

Re: Check Wireguard tunnel

The newer /tool/netwatch might allow that logic with "On Test" script, you'd just check the last down time >10m in the script before restart.
I don't quite understand how I could do it with Netwatch, could you give an example?
by diamuxin
Sun Apr 23, 2023 11:28 pm
Forum: Scripting
Topic: Check Wireguard tunnel
Replies: 6
Views: 5144

Re: Check Wireguard tunnel

Curious as to why you ping an internal WG address to see if connection is up?? Assuming this is a client router and the subnet is on the other router?? Because that subnet is only accessed through the wireguard tunnel. You could also put the IP of the other end of the tunnel, for example 172.17.50....
by diamuxin
Sun Apr 23, 2023 9:11 pm
Forum: Scripting
Topic: Check Wireguard tunnel
Replies: 6
Views: 5144

Check Wireguard tunnel

Hi, I have this script that checks the connection of a wireguard tunnel between two sites. :if ([/ping 192.168.88.1 interval=500ms count=10]<8) do={ :local deviceName [/system/identity/get name] :local iFaceName "wg-sts" :log error "Wireguard: Tunnel with SiteB is down! Reconnecting.....
by diamuxin
Sun Apr 16, 2023 5:08 pm
Forum: Scripting
Topic: send MikroTik Notification via WhatsApp
Replies: 55
Views: 48660

Re: send MikroTik Notification via WhatsApp

hi all good time how to send MikriTik Message ( Notifications ) via WhatsApp ? example : https://wiki.mikrotik.com/wiki/Manual:The_Dude_v6/Dude_Telegram_Example best regards Hi there! To send MikroTik notifications via WhatsApp, you'll need to follow these steps: 1. Set up a WhatsApp Business Accou...
by diamuxin
Sat Apr 08, 2023 3:24 pm
Forum: Scripting
Topic: I did it! Script to compute UNIX time!
Replies: 36
Views: 32046

Re: I did it! Script to compute UNIX time!

Awesome, as always rextended to the rescue!
:wink:
by diamuxin
Wed Mar 15, 2023 2:20 pm
Forum: Scripting
Topic: I did it! Script to compute UNIX time!
Replies: 36
Views: 32046

Re: I did it! Script to compute UNIX time!

Interesting, thank you!

I've tried it and something is wrong here:
[] > :put [$str2case "this iS a teSt ,a teSt is it"]
This is a test ,a test is it
U and L works fine.

BR.
by diamuxin
Thu Mar 02, 2023 6:51 pm
Forum: Scripting
Topic: Fully Working Mikrotik Router OS Backup Script on local storage and FTP Upload [SOLVED]
Replies: 21
Views: 36339

Re: Fully Working Mikrotik Router OS Backup Script on local storage and FTP Upload [SOLVED]

Only one small thing missing in RouterOS. After backup is done, save the file and upload it. Also make a hash of the backup file. Next day, after a new backup file are made, compare it to yesterdays backup file using hash, if no change, do not send file to FTP. That's a very interesting idea, how d...
by diamuxin
Tue Feb 28, 2023 11:44 am
Forum: Scripting
Topic: Convert uptime to date and time [SOLVED]
Replies: 46
Views: 13270

Re: Convert uptime to date and time [SOLVED]

Ok, I found two bug, fixed.
Update previous script.
The script works fine now, thanks!

BR.
by diamuxin
Tue Feb 28, 2023 2:52 am
Forum: Scripting
Topic: Convert uptime to date and time [SOLVED]
Replies: 46
Views: 13270

Re: Convert uptime to date and time [SOLVED]

search tags # rextended online uptime start date time Work correctly only if RouterBOARD time is syncronized. Hi @rextended! With this "approximate" data, I think there is a small mismatch in your script, because there is something strange in the result: Uptime: 00:25:39 Local Date: 28/02...
by diamuxin
Sat Feb 18, 2023 1:23 am
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Re: Convert any text to UNICODE

Amazing!
thank you for your great work.

BR.
by diamuxin
Sun Feb 12, 2023 3:46 pm
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Re: Convert any text to UNICODE

Considering that the SMS message is extracted from my modem in UTF-8 format (I have already commented it on https://forum.mikrotik.com/viewtopic.php?t=193491#p983556) <?xml version="1.0" encoding="UTF-8"?> <response> <Count>1</Count> <Messages> <Message> <Smstat>0</Smstat> <Index...
by diamuxin
Sat Feb 11, 2023 8:20 pm
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Re: Convert any text to UNICODE

In that case, I tried with the $fURLEncode function but it doesn't work either. # ------------------- fURLEncode ---------------------- # :global fURLEncode do={ :local Chars {" "="%20";"!"="%21";"#"="%23";"%"="%25";&quo...
by diamuxin
Sat Feb 11, 2023 7:18 pm
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Re: Convert any text to UNICODE

How are you getting that XML? The message is extracted directly in XML from a Huawei USB modem using an API built into the device by that manufacturer. Starting from this function (token parser library) # TOKEN PARSER LIBRARY # v1.0.0 pkt # :put [($tokenParser->"getTag") source=$xml tag=&...
by diamuxin
Sat Feb 11, 2023 6:13 pm
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Re: Convert any text to UNICODE

Hello, what a nice surprise to read this progress on the recoding of characters valid for Telegram, thanks to both of you for your interest. No, Amm0 don't worry, I'm working with the spanish language, I mainly wanted to make it compatible with "ñ" and acute accents like "á, é, í, ó, ...
by diamuxin
Sat Feb 11, 2023 1:33 am
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Re: Convert any text to UNICODE

To write a defined text is fine, but the study is to be able to extract any text from a received SMS and forward it by Telegram with Unicode characters, so it could be read in Telegram. I have tried to see how this converter works [ https://r-1.ch/mikrotik-unicode-ssid-generator.php ], but my progra...
by diamuxin
Fri Feb 10, 2023 8:18 pm
Forum: General
Topic: Add emoji to the ssid name
Replies: 38
Views: 20187

Re: Add emoji to the ssid name

Great job!
Thanks.


BR.
by diamuxin
Fri Feb 10, 2023 8:14 pm
Forum: Scripting
Topic: Convert any text to UNICODE
Replies: 40
Views: 11287

Convert any text to UNICODE

Hello, Is it possible to create in RouterOS a converter similar to this one? https://r-1.ch/mikrotik-unicode-ssid-generator.php I have found that by converting any text to UNICODE, it can be displayed on the terminal screen and also recognizes it correctly in Telegram (would be a great solution). Fo...
by diamuxin
Fri Feb 10, 2023 2:33 pm
Forum: Scripting
Topic: Convert uptime to date and time [SOLVED]
Replies: 46
Views: 13270

Re: Convert uptime to date and time [SOLVED]

Even better, taking the functions you created for the Mikrotik Uptime, it can work for me as well and is quite accurate. https://forum.mikrotik.com/viewtopic.php?p=977167#p930465 Now it would look better: { :global tokenParser :global unixtodatetime :global currdatetimestr :local xmlData ([toarray [...
by diamuxin
Fri Feb 10, 2023 1:42 pm
Forum: Scripting
Topic: Convert uptime to date and time [SOLVED]
Replies: 46
Views: 13270

Re: Convert uptime to date and time [SOLVED]

Yes, I want as I said in the previous post is, starting from an uptime in seconds by value XXXXXXXXX sg, convert it to an easily understandable value, it does not matter if it is with Mo+Days+Hours+Minutes+Seconds format or YYYY-MM-DD hh.mm.ss. I don't know if I have explained myself well. I underst...
by diamuxin
Thu Feb 09, 2023 10:06 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

By the way, the smsSend function sends SMS, putting them in the list of sent messages with a wrong date (I have all the messages sent via the API dated December 31, 1969. If the messages from the WEB interface are sent correctly). It works fine for me. [admin@MikroTik] > $sendSMS lteIP="192.16...
by diamuxin
Thu Feb 09, 2023 8:03 pm
Forum: Scripting
Topic: Convert uptime to date and time [SOLVED]
Replies: 46
Views: 13270

Re: Convert uptime to date and time [SOLVED]

Ciao rextended, Today I come with a new challenge, I want to convert an Uptime figure of a remote device that I want to control, the detail that the value is in seconds (I think): <uptime>546837</uptime> (That numeric value I already have it extracted and assigned to a local variable) I have designe...
by diamuxin
Thu Feb 09, 2023 4:05 pm
Forum: Scripting
Topic: find behaves in wierd ways if you pass it something like `domain="$domain"`
Replies: 12
Views: 2250

Re: find behaves in wierd ways if you pass it something like `domain="$domain"`

All the signature, for abuse, are removed.
I understand, thank you.

..
by diamuxin
Thu Feb 09, 2023 3:18 pm
Forum: Scripting
Topic: find behaves in wierd ways if you pass it something like `domain="$domain"`
Replies: 12
Views: 2250

Re: find behaves in wierd ways if you pass it something like `domain="$domain"`

Sorry for the off-topic Rex, what about your link to your scripts?
I don't see it in the signature.
by diamuxin
Thu Feb 09, 2023 1:29 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

I didn't mean to offend you or "offend your modem". And my contribution to the scripts is here: https://forummikrotik.ru/viewtopic.php?f=14&t=13947 Now I am busy writing my own Telegram Notifier and Runner system, which differs from the existing works. I am also writing a universal fu...
by diamuxin
Thu Feb 09, 2023 10:59 am
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

I think this will work even if Count tag is empty or non-existent: :global tokenParser :global recvSMS :local xmlSmsList ([$recvSMS]->"data") :local smsCount [:tonum [($tokenParser->"getTag") source=$xmlSmsList tag="Count"]] :if ($smsCount > 0) do={ ... } Thank you ver...
by diamuxin
Thu Feb 09, 2023 10:46 am
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

By the way, Huawei E3372h-320 modem is much worse than the earlier model E3372h-153. Modification 320 does not have an SD slot, does not have the ability to connect external antennas and does not have the ability to change the firmware to alternative ones. You are totally wrong (and more if you hav...
by diamuxin
Wed Feb 08, 2023 9:37 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

Collection of Huawei API scripts for use with MikroTik (Tested on a Huawei E3372h-320 modem) Token Parser Library (Main Script base) # TOKEN PARSER LIBRARY # v1.0.0 pkt # :put [($tokenParser->"getTag") source=$xml tag="SessionInfo"] # ($tokenParser->"getBetween") # get...
by diamuxin
Wed Feb 08, 2023 9:07 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

There are many scripts written here, but there is no system, you can get confused ... Is it possible to ask the authors to put this chaos in order? As far as I understand, there are ready-made functions You can not demand that the information in the thread is ordered to your liking, especially when...
by diamuxin
Wed Feb 08, 2023 8:50 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

Hi @pkt, Starting from this: <Count>1</Count> for example. How can I do to execute an action if <Count> is >0. I have started like this: [admin@MikroTik] > :put ([$recvSMS]->"data") <?xml version="1.0" encoding="UTF-8"?> <response> <Count>1</Count> <Messages> <Message> ...
by diamuxin
Wed Feb 08, 2023 2:49 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

Hi @pkt, One last question please, is it possible to delete also the sent SMS? when I enter the web-ui 192.168.8.1, I see that the received SMS are deleted correctly, however the sent SMS are visible. It is not important, just curious. Edit: I reply to myself: The key is in the following: <BoxType>2...
by diamuxin
Tue Feb 07, 2023 8:04 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

How ñ and Ó on terminal???????? What you use SSL? Telenet? Other? On 7.7 I haven't find any way to print other characters. Is a script results??? Hmmm.... I use MobaXterm as an external terminal SSH, it is wonderful and very visual. https://i.postimg.cc/D0P9N6BT/image.png I can read SMS, but I can'...
by diamuxin
Tue Feb 07, 2023 7:47 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

Probably using the API of the Huawei, is possible to send one message with "ñ" or "€" simply converting first the message with ASCIItoCP1252toUTF8. If your codepage is not CP1252 / Windows 1252, must be done one appropriate function using the ASCIItoCP1252toUTF8 as base. When an...
by diamuxin
Tue Feb 07, 2023 4:51 pm
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

I use Telegram in most of my scripts, I tried it at the time here and I had errors with the encoding of some SMS characters, so I discarded it. The 2nd function on my post can be used before sent the string (ASCII-7 and/or CP125x) to telegram (UTF-8): https://forum.mikrotik.com/viewtopic.php?t=1775...
by diamuxin
Tue Feb 07, 2023 9:59 am
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

I use Telegram in most of my scripts, I tried it at the time here and I had errors with the encoding of some SMS characters, so I discarded it.
by diamuxin
Tue Feb 07, 2023 12:29 am
Forum: Scripting
Topic: Send SMS messages via Huawei LTE modem API (tested with E3372)
Replies: 84
Views: 28002

Re: Send SMS messages via Huawei LTE modem API (tested with E3372)

Maybe you have not delSMS in scope. If it is not defined in the same script or function in which is used, it's necessary to "import" the symbol declaring it. You can try to put :global delSMS in a line before the foreach one. You are right, declaring the global variable "delSMS"...
  • 1
  • 2