TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Open youtube link on any browser & play using autohotkey😎

    Scheduled Pinned Locked Moved Example Commands
    1 Posts 1 Posters 972 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • trinibT Offline
      trinib
      last edited by

      • Requires Autohotkey (v2.0).
      • Create ahk file, enter code:
      #Requires AutoHotkey v2.0
      
      ;–– Settings ––
      videoURL := "PUT_URL_HERE"
      
      ;–– Locate Browser (Firefox in this examaple) ––
      path64 := A_ProgramFiles . "\Mozilla Firefox\firefox.exe"
      path86 := A_ProgramFiles . " (x86)\Mozilla Firefox\firefox.exe"
      if FileExist(path64)
          firefoxPath := path64
      else if FileExist(path86)
          firefoxPath := path86
      else {
          MsgBox("Could not find firefox.exe.", "Error")
          ExitApp()
      }
      
      ;–– Open in a new tab ––
      Run( Format('{} -new-tab "{}"', firefoxPath, videoURL) )
      
      ;–– Wait for YouTube tab/window ––
      SetTitleMatchMode(2)
      if !WinWait("YouTube", "", 10) {
          MsgBox("YouTube window not found.", "Error")
          ExitApp()
      }
      
      ;–– Maximize & focus ––
      hWnd := WinExist("YouTube")
      WinMaximize(hWnd)
      WinActivate(hWnd)
      WinWaitActive(hWnd, "", 5)
      
      ;–– Let it load & play ––
      Sleep(7000)
      Send("{Space}")
      
      ExitApp
      
      • In triggercmd add new command.
      • Command - location of file(C:\Users\Admin\Desktop\yourfile.ahk)

      LINUX(Requires X11, does not work with Wayland yet) - https://github.com/phil294/AHK_X11
      Code (have not tested):

      #!/usr/bin/env ahk_x11
      #NoEnv
      #SingleInstance force
      
      ;–– Settings ––
      playlistURL = PUT_URL_HERE
      
      ;–– Open in a new tab of your default Firefox ––
      ; The --new-tab flag will reuse an existing window if there is one.
      Run firefox --new-tab "%playlistURL%"
      
      ;–– Wait (up to 10s) for any window with β€œYouTube” in its title ––
      WinWait YouTube,,,10
      if ErrorLevel
      {
          MsgBox YouTube window not found.
          ExitApp
      }
      
      ;–– Maximize & focus ––
      WinMaximize YouTube
      WinActivate YouTube
      WinWaitActive YouTube,,,5
      
      ;–– Give time for the page to load ––
      Sleep 7000
      
      ;–– Toggle play/pause via Space ––
      Send {Space}
      
      ExitApp
      
      • chmod +x yourfile.ahk
      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better πŸ’—

      Register Login
      • First post
        Last post