Only half of the script is running

I have a couple of scripts and when I select them and click run on the script box in Winbox they run fine. If I use the command line /system script run [/system script find name=SwapSpeedDay] to run the certain script only part of it runs. It is like it skips the first part where it enables all the Day Queues and then it disables all the night queues. I have anther script that reverses the actions below and it does the same thing.

It runs fine as long as I run it from winbox. If I run it from the command line though it does the same thing every time.

Can anyone see any errors in my code or have a better way to code this so it works everytime.

Thanks


SwapSpeedDay

:foreach I in=[/queue simple find queue=Ether-Day-Home/Ether-Day-Home] do={
/queue simple enable $I
}

:foreach I in=[/queue simple find queue=Ether-Night-Home/Ether-Night-Home] do={
/queue simple disable $I
}

I have totally rewritten the scripts I was using. Then new script seems to be working a lot better then the old on was. I will give it a few days and see how things go with the new one.