Advertisement
buttonpushertv

CHROME-FCM-VIDEO-WATCHER

Nov 11th, 2021
1,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; AutoHotKey - CHROME-FCM-VIDEO-WATCHER.ahk
  2. ; by Ben Howard - ben@buttonpusher.tv
  3.  
  4. ;===== START OF AUTO-EXECUTION SECTION =========================================================
  5. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  6. ; #Warn  ; Enable warnings to assist with detecting common errors.
  7. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  8. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  9. ; #Persistent ; Keeps script permanently running.
  10. #SingleInstance force ; Ensures that there is only a single instance of this script running.
  11. ; SetTitleMatchMode, 2 ; sets title matching to search for "containing" instead of "exact"
  12.  
  13. ;===== INITIALIZATION - VARIABLES ==============================================================
  14. ; Sleep shortcuts - use these to standardize sleep times
  15. ; These are milliseconds - 1000 ms = 1 sec
  16. sleepMicro := 5
  17. sleepMini := 15
  18. sleepShort := 333
  19. sleepMedium := 666
  20. sleepLong := 1500
  21. sleepDeep := 3500
  22.  
  23. ;===== END OF AUTO-EXECUTE =====================================================================
  24. ;===== MODIFIER MEMORY HELPER ==================================================================
  25. ; combine below with key and '::' to define hotkey
  26. ; e.g.- ^f1::Msgbox You pressed Control and F1
  27. ; #=Win | !=Alt | ^=Ctrl | +=Shift | &=combine keys | *=ignore other mods
  28. ; <=use left mod key| >=use right mod key  | UP=fires on release
  29.  
  30. ;===== MAIN HOTKEY DEFINITIONS HERE ============================================================
  31.  
  32. #IfWinActive, ahk_exe chrome.exe ; this command limits the function of these hotkeys to work only when Chrome is the foreground application. They will not work outside of Chrome. If you use Firefox, then change the 'chrome.exe' bit above to 'firefox.exe'. And if you use Edge, change it to 'msedge.exe'.
  33.  
  34. CoordMode, Mouse, Client
  35.  
  36. !z:: ; <-- ALT-Z trigger the functions below.
  37.     ; This hotkey is setup to work with Chrome on a 1920x1200 screen (my laptop)
  38.     ; I wanted to be able to advance to the next video easily.
  39.     ; You will want to use AHK's Window Spy to adjust the spots where the 'Click' events happen below. And make sure you are reading the coordinates from the 'Client' line in Window Spy.
  40.     ;
  41.     ; Also, based on your connection speed, you may need to adjust the 'sleepMedium' and 'sleepLong' values up above. If you are on a slow connection, make them longer.
  42.  
  43.     Send, {Escape} ; Escape to exit previous full screen video
  44.     Sleep, sleepMedium ; wait for a medium amount of time
  45.     Click, 1300, 975 ; this clicks on the next video button, under the video frame on the right
  46.     Sleep, sleepLong ; wait for a longer time (giving page a chance to load)
  47.     Click, 1100, 620 ; this clicks on the center of the video area to start playback
  48.     Sleep, sleepLong ; wait for a longer time (giving page a chance to load)
  49.     Click, 1561, 872 ; this clicks on the full screen button to make video full screen.
  50.     ;
  51.     ; Once video is playing, as long as you keep the video window focused, you can hit spacebar to pause or restart playback.
  52.  
  53.     Return
  54.  
  55. #IfWinActive
  56. ;===== FUNCTIONS ===============================================================================
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement