mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-06-25 02:58:38 +02:00
Update for v1.03
This commit is contained in:
parent
086e3e6f1d
commit
e694bc14f9
22 changed files with 22 additions and 22 deletions
|
@ -25,7 +25,7 @@ if ( [:typeof $WanInterfaces] != "array") do={
|
||||||
:local InterfaceId [/interface ethernet find name=$WanInterface];
|
:local InterfaceId [/interface ethernet find name=$WanInterface];
|
||||||
|
|
||||||
:local UpDown "down";
|
:local UpDown "down";
|
||||||
if ([:interface ethernet get $InterfaceId]->"running") do={
|
if ([/interface ethernet get $InterfaceId]->"running") do={
|
||||||
:set UpDown "up"
|
:set UpDown "up"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:put "Hello, I hope you're well.";
|
:put "Hello, I hope you're well.";
|
||||||
|
|
||||||
# Check if the time is after 6pm (get time in 21:46:04 format)
|
# Check if the time is after 6pm (get time in 21:46:04 format)
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# Say good evening if time is after 18:00
|
# Say good evening if time is after 18:00
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:put "Hello, I hope you're well.";
|
:put "Hello, I hope you're well.";
|
||||||
|
|
||||||
# Check if the time is after 6pm (get time in 21:46:04 format)
|
# Check if the time is after 6pm (get time in 21:46:04 format)
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# Say good morning if time is before 12:00
|
# Say good morning if time is before 12:00
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-04-if-else-vars.rsc
|
# filename: ch7-04-if-else-vars.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# Check if it's after noon
|
# Check if it's after noon
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-05-if-else-vars2.rsc
|
# filename: ch7-05-if-else-vars2.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# declare the time of day variable
|
# declare the time of day variable
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-06-multiple-conditions.rsc
|
# filename: ch7-06-multiple-conditions.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# declare the time of day variable
|
# declare the time of day variable
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-07-nested-if-statements.rsc
|
# filename: ch7-07-nested-if-statements.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# declare the time of day variable
|
# declare the time of day variable
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
:local UpDown;
|
:local UpDown;
|
||||||
|
|
||||||
if ([:interface ethernet get $InterfaceId]->"running") do={
|
if ([/interface ethernet get $InterfaceId]->"running") do={
|
||||||
:set UpDown "up";
|
:set UpDown "up";
|
||||||
} else={
|
} else={
|
||||||
:set UpDown "down";
|
:set UpDown "down";
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
:local InterfaceId [/interface ethernet find name=$WanInterfaceName];
|
:local InterfaceId [/interface ethernet find name=$WanInterfaceName];
|
||||||
|
|
||||||
:local UpDown "down";
|
:local UpDown "down";
|
||||||
if ([:interface ethernet get $InterfaceId]->"running") do={
|
if ([/interface ethernet get $InterfaceId]->"running") do={
|
||||||
:set UpDown "up"
|
:set UpDown "up"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:set LoopCounter ($LoopCounter - 1);
|
:set LoopCounter ($LoopCounter - 1);
|
||||||
|
|
||||||
# add in a pause to prevent cpu thrashing
|
# add in a pause to prevent cpu thrashing
|
||||||
delay 1;
|
:delay 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# print a message when/if the loop exits
|
# print a message when/if the loop exits
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# filename: ch8-06-while-with-exit.rsc
|
# filename: ch8-07-while-with-exit.rsc
|
||||||
|
|
||||||
# Let's create a loop using "while"
|
# Let's create a loop using "while"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ if ( [:typeof $WanInterfaces] != "array") do={
|
||||||
:local InterfaceId [/interface/ethernet find name=$WanInterface];
|
:local InterfaceId [/interface/ethernet find name=$WanInterface];
|
||||||
|
|
||||||
:local UpDown "down";
|
:local UpDown "down";
|
||||||
if ([:interface/ethernet get $InterfaceId]->"running") do={
|
if ([/interface/ethernet get $InterfaceId]->"running") do={
|
||||||
:set UpDown "up"
|
:set UpDown "up"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:put "Hello, I hope you're well.";
|
:put "Hello, I hope you're well.";
|
||||||
|
|
||||||
# Check if the time is after 6pm (get time in 21:46:04 format)
|
# Check if the time is after 6pm (get time in 21:46:04 format)
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# Say good evening if time is after 18:00
|
# Say good evening if time is after 18:00
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:put "Hello, I hope you're well.";
|
:put "Hello, I hope you're well.";
|
||||||
|
|
||||||
# Check if the time is after 6pm (get time in 21:46:04 format)
|
# Check if the time is after 6pm (get time in 21:46:04 format)
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# Say good morning if time is before 12:00
|
# Say good morning if time is before 12:00
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-04-if-else-vars.rsc
|
# filename: ch7-04-if-else-vars.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# Check if it's after noon
|
# Check if it's after noon
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-05-if-else-vars2.rsc
|
# filename: ch7-05-if-else-vars2.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# declare the time of day variable
|
# declare the time of day variable
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-06-multiple-conditions.rsc
|
# filename: ch7-06-multiple-conditions.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# declare the time of day variable
|
# declare the time of day variable
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# filename: ch7-07-nested-if-statements.rsc
|
# filename: ch7-07-nested-if-statements.rsc
|
||||||
|
|
||||||
# Get the current time
|
# Get the current time
|
||||||
:local CurrentTime [:system clock get time];
|
:local CurrentTime [/system clock get time];
|
||||||
:put "The current time is : $CurrentTime";
|
:put "The current time is : $CurrentTime";
|
||||||
|
|
||||||
# declare the time of day variable
|
# declare the time of day variable
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
:local UpDown;
|
:local UpDown;
|
||||||
|
|
||||||
if ([:interface ethernet get $InterfaceId]->"running") do={
|
if ([/interface ethernet get $InterfaceId]->"running") do={
|
||||||
:set UpDown "up";
|
:set UpDown "up";
|
||||||
} else={
|
} else={
|
||||||
:set UpDown "down";
|
:set UpDown "down";
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
:local InterfaceId [/interface/ethernet find name=$WanInterfaceName];
|
:local InterfaceId [/interface/ethernet find name=$WanInterfaceName];
|
||||||
|
|
||||||
:local UpDown "down";
|
:local UpDown "down";
|
||||||
if ([:interface/ethernet get $InterfaceId]->"running") do={
|
if ([/interface/ethernet get $InterfaceId]->"running") do={
|
||||||
:set UpDown "up"
|
:set UpDown "up"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:set LoopCounter ($LoopCounter - 1);
|
:set LoopCounter ($LoopCounter - 1);
|
||||||
|
|
||||||
# add in a pause to prevent cpu thrashing
|
# add in a pause to prevent cpu thrashing
|
||||||
delay 1;
|
:delay 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# print a message when/if the loop exits
|
# print a message when/if the loop exits
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# filename: ch8-06-while-with-exit.rsc
|
# filename: ch8-07-while-with-exit.rsc
|
||||||
|
|
||||||
# Let's create a loop using "while"
|
# Let's create a loop using "while"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue