Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SendToYouTube(key)
- {
- TabDelay := 50
- WinGet, BrowserWindows, List, ahk_exe firefox.exe
- Loop, %BrowserWindows%
- {
- BrowserId := BrowserWindows%A_Index%
- WinGetTitle, BrowserTitle, ahk_id %BrowserId%
- IfInString, BrowserTitle, YouTube
- {
- IfNotInString, BrowserTitle, Subscriptions
- {
- ControlSend, , %key%, ahk_id %BrowserId%
- SetCapsLockState, AlwaysOff
- return
- }
- }
- }
- Loop, %BrowserWindows%
- {
- BrowserId := BrowserWindows%A_Index%
- toSend := [1,2,3,4,5,6,7,8]
- for v, key in toSend
- {
- ControlSend, , {LCtrl down}{%key%}{LCtrl up}, ahk_id %BrowserId%
- Sleep, %TabDelay%
- WinGetTitle, BrowserTitle, ahk_id %BrowserId%
- Sleep, %TabDelay%
- IfInString, BrowserTitle, YouTube
- {
- IfNotInString, BrowserTitle, Subscriptions
- {
- ControlSend, , k, ahk_id %BrowserId%
- SetCapsLockState, AlwaysOff
- return
- }
- }
- }
- SetCapsLockState, AlwaysOff
- }
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement