Advertisement
Guest User

sendtoyoutube

a guest
Oct 19th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SendToYouTube(key)
  2. {
  3.     TabDelay := 50
  4.  
  5.     WinGet, BrowserWindows, List, ahk_exe firefox.exe
  6.    
  7.    
  8.     Loop, %BrowserWindows%
  9.     {
  10.         BrowserId := BrowserWindows%A_Index%
  11.         WinGetTitle, BrowserTitle, ahk_id %BrowserId%
  12.         IfInString, BrowserTitle, YouTube
  13.         {
  14.             IfNotInString, BrowserTitle, Subscriptions
  15.             {
  16.                 ControlSend, , %key%, ahk_id %BrowserId%
  17.                 SetCapsLockState, AlwaysOff
  18.                 return
  19.             }
  20.         }
  21.     }
  22.     Loop, %BrowserWindows%
  23.     {
  24.         BrowserId := BrowserWindows%A_Index%
  25.         toSend := [1,2,3,4,5,6,7,8]
  26.         for v, key in toSend
  27.         {
  28.             ControlSend, , {LCtrl down}{%key%}{LCtrl up}, ahk_id %BrowserId%
  29.             Sleep, %TabDelay%
  30.             WinGetTitle, BrowserTitle, ahk_id %BrowserId%
  31.             Sleep, %TabDelay%
  32.             IfInString, BrowserTitle, YouTube
  33.             {
  34.                 IfNotInString, BrowserTitle, Subscriptions
  35.                 {
  36.                     ControlSend, , k, ahk_id %BrowserId%
  37.                     SetCapsLockState, AlwaysOff
  38.                     return
  39.                 }
  40.             }
  41.         }
  42.         SetCapsLockState, AlwaysOff
  43.     }
  44.     return
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement