How do I restrict the script to work only when the mouse is over the taskbar?
you can make it work conditionally by adding these lines below in each of the WheelUp/Down command.
MouseGetPos, , , id, control
WinGetClass, class, ahk_id %id%
If class = Shell_TrayWnd
i'm also attaching the modified script, subject to the original author's permission.