web-dev-qa-db-ja.com

キーボードを使用して別のウィンドウでビデオの動作を制御する

私は翻訳の仕事をしているので、ウィンドウを2つの部分に分割しました。左側は翻訳したいビデオ用、右側は編集者用です。

GoogleのYoutube ChromeとMicrosoftWordを例に取ってください。左側の1つの文を聞くたびに、ビデオを停止してWordに切り替え、翻訳します。Wordの入力が終了したら、 Google Chromeに戻り、ビデオを再起動します。その進行が繰り返されます。

PS。私は別の外国語を学んでいます、翻訳をすることは聞くのに良いと聞きました。

それらを切り替えるのは本当に面倒な仕事です(Win + numでも)。Wordに固執し、グローバルキーボードを使用して別のウィンドウでビデオの動作(進む、戻る、一時停止、開始)を制御する方法はありますか?

私はWindows7を使用していますが、メソッドが存在しない場合は、Linux/Unixの回答も歓迎します。

1
Ynjxsjmh

次のコメントの多い AutoHotkey スクリプトは投稿から取得されました 別のウィンドウからYoutubeを再生/一時停止するスクリプト

ザ・ K キャラクターはYouTubeビデオを停止/開始します。このスクリプトは、次のキーの組み合わせによってトリガーされます。 Ctrl+Space。 Chromeとその再生タブを見つけて、 K 文字、すべてフォーカスされたウィンドウを変更せずに(私はWordだと思います)。

AutoHotKeyをインストールした後、上記のテキストを.ahkファイルに入れ、ダブルクリックしてテストします。トレイバーの緑色のHアイコンを右クリックし、[終了]を選択すると、スクリプトを停止できます。ログイン時に実行するには、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
harrymc