Note that you use xdotool which is external so you are cheating. On Winodws you can do better with AHK which is compared to xdotool like spaceship to bucycle.
Note that comparing AHK to xdotool is like comparing a Titanic-sized roll of Flex Tape to duct tape. I don’t use boats that have taken a lot of damage, so I don't need Titanic-sized Flex Tape.