Cycling via web browser tabs with autokail

I am trying to make a macro that will cycle through and refresh the browser tabs when I press "F10". Currently it only refreshes the page I am on, it doesn't go through them, I tried searching on it but all the answers were for "AutoHotKey". So I looked at the documentation for "AutoKey" and tried to convert the "AutoHotKey" script to "AutoKey" (python) but it doesn't work and I have no idea why.

Here's the script

keyboard.send_keys ("<f5>")

keyboard.press_key ("<ctrl>")

keyboard.send_keys ("<tab>")

keyboard.release_key ("<ctrl>")

replacing lines 2 -> 4 with just "keyboard.press_key" ("<ctrl>" + "<tab>") doesn't work (I'm not entirely sure if ("<ctrl> + <tab>"), but neither one doesn't work unfortunately)

(Please keep in mind that the spaces before "keycodes" are such that Stackoverflow will show them)

Thank you all in advance !!!

+3


source to share


2 answers


I asked the Google AutoKey group and they came up with this:

keyboard.send_keys("<f5><ctrl>+<tab>")

      



And everything you need works flawlessly. I would later change "f5" to 'enter' and it will never miss any browser tab, that's awesome!

Thanks everyone for your time!

+3


source


This weirdly only worked for me, but I think it might still do your task:

keyboard.press_key("<ctrl>")
keyboard.press_key("<tab>")
time.sleep(0.3)
keyboard.release_key("<ctrl>")
keyboard.release_key("<tab>")
keyboard.send_key("<f5>")

      



Hope this helps.

+1


source







All Articles