2

I'm doing some translation job, so I split my window into two parts, the left part for the video I want to translate, the right for the editor.

Just take Youtube in Google Chrome and Microsoft Word for example. Every time I listen one sentence in the left part, I stop the video and switch to the Word then translate. After finishing typing in Word, I switch back to Google Chrome and restart the video. That progress repeats.

PS. I'm learning another foreign language, I heard that doing translation is good for listening.

It's really an annoying job to switch between them (even with Win + num), is there a method to stick in Word and just use global keyboard to control the video behavior (forward, backward, pause, start) in another window?

I'm on Windows 7, but if there exisits no method in it, answers for Linux/Unix are also welcome.

2
  • Keyboard shortcuts are for the most part application-specific, and when you lose focus those shortcuts don't apply. What I mean by that is, if in Chrome the keyboard shortcut to pause is ctrl+p, when your focus is set to Word that key combination would take you to the print dialog. I don't know if Auto HotKey has global keyboard shortcuts which can be fired at a specific modal window, but it's unlikely. Commented Mar 9, 2020 at 8:27
  • @spikey_richie Thank you for your instant response, if it's what you describe, that's really a pity. Do you know is there any convinient way for my workflow?
    – Ynjxsjmh
    Commented Mar 9, 2020 at 8:35

2 Answers 2

2

The following heavily-commented AutoHotkey script was taken from the post Script to Play/Pause Youtube from another Window.

The K character stops/starts YouTube video. This script is triggered by the key combination of Ctrl+Space. It will find Chrome and its playing tab and send it the K character, all without changing the focused window (which I presume is Word).

After installing AutoHotKey, put the above text in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

;============================== Start Auto-Execution Section ==============================

; Keeps script permanently running
#Persistent

; Avoids checking empty variables to see if they are environment variables
; Recommended for performance and compatibility with future AutoHotkey releases
#NoEnv

; Ensures that there is only a single instance of this script running
#SingleInstance, Force

;Determines whether invisible windows are "seen" by the script
DetectHiddenWindows, On

; Makes a script unconditionally use its own folder as its working directory
; Ensures a consistent starting directory
SetWorkingDir %A_ScriptDir%

; sets title matching to search for "containing" isntead of "exact"
SetTitleMatchMode, 2

;sets controlID to 0 every time the script is reloaded
controlID       := 0

return

;============================== Main Script ==============================
#IfWinNotActive, ahk_exe chrome.exe

ctrl & space::
    ; Gets the control ID of google chrome
    ControlGet, controlID, Hwnd,,Chrome_RenderWidgetHostHWND1, Google Chrome

    ; Focuses on chrome without breaking focus on what you're doing
    ControlFocus,,ahk_id %controlID%

    ; Checks to make sure YouTube isn't the first tab before starting the loop
    ; Saves time when youtube is the tab it's on
    IfWinExist, YouTube
    {
        ControlSend, Chrome_RenderWidgetHostHWND1, k , Google Chrome
        return
    }

    ; Sends ctrl+1 to your browser to set it at tab 1
    ControlSend, , ^1, Google Chrome

    ; Starts loop to find youtube tab
    Loop
    {
        IfWinExist, YouTube
        {
            break
        }

        ;Scrolls through the tabs.
        ControlSend, ,{Control Down}{Tab}{Control Up}, Google Chrome

        ; if the script acts weird and is getting confused, raise this number
        ; Sleep, is measures in milliseconds. 1000 ms = 1 sec
        Sleep, 150
    }

    Sleep, 50

    ; Sends the K button to chrome
    ; K is the default pause/unpause of YouTube (People think space is. Don't use space!
    ; It'll scroll you down the youtube page when the player doesn't have focus.
    ControlSend, Chrome_RenderWidgetHostHWND1, k , Google Chrome
return

#IfWinNotActive

;============================== End Script ==============================
2
  • That helps a lot, any idea on the other two behaviors, backward and forward? I found some extensions can do that, I think the idea behind them is similar, sending certain control key to Google Chrome. The next goal for me is to find out which key represents forward/backward. It would be really helpful if there is any open source tool. After I install AutoHotkey and try that script, I will give you feedback.
    – Ynjxsjmh
    Commented Mar 9, 2020 at 10:20
  • This would mean adding hotkeys the same as above, except sending {Left} and {Right} instead of k. Candidate hotkeys are perhaps Alt+Left/Right.
    – harrymc
    Commented Mar 9, 2020 at 10:25
0

I looked around and found these 2 plugins that does the job. You will need to configure shortcut keys within Chrome. Both plugins explain how this is done in their pages. YouTube Anywhere Remote covers more functions of YouTube including fast forward and rewind, which I was looking for.

YouTube Anywhere Remote streamkeys

YouTube Anywhere Remote plugin keyboard shortcut settings in Chrome

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 18, 2023 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .