Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; AutoHotKey - CHROME-FCM-VIDEO-WATCHER.ahk
- ; by Ben Howard - ben@buttonpusher.tv
- ;===== START OF AUTO-EXECUTION SECTION =========================================================
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- ; #Persistent ; Keeps script permanently running.
- #SingleInstance force ; Ensures that there is only a single instance of this script running.
- ; SetTitleMatchMode, 2 ; sets title matching to search for "containing" instead of "exact"
- ;===== INITIALIZATION - VARIABLES ==============================================================
- ; Sleep shortcuts - use these to standardize sleep times
- ; These are milliseconds - 1000 ms = 1 sec
- sleepMicro := 5
- sleepMini := 15
- sleepShort := 333
- sleepMedium := 666
- sleepLong := 1500
- sleepDeep := 3500
- ;===== END OF AUTO-EXECUTE =====================================================================
- ;===== MODIFIER MEMORY HELPER ==================================================================
- ; combine below with key and '::' to define hotkey
- ; e.g.- ^f1::Msgbox You pressed Control and F1
- ; #=Win | !=Alt | ^=Ctrl | +=Shift | &=combine keys | *=ignore other mods
- ; <=use left mod key| >=use right mod key | UP=fires on release
- ;===== MAIN HOTKEY DEFINITIONS HERE ============================================================
- #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'.
- CoordMode, Mouse, Client
- !z:: ; <-- ALT-Z trigger the functions below.
- ; This hotkey is setup to work with Chrome on a 1920x1200 screen (my laptop)
- ; I wanted to be able to advance to the next video easily.
- ; 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.
- ;
- ; 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.
- Send, {Escape} ; Escape to exit previous full screen video
- Sleep, sleepMedium ; wait for a medium amount of time
- Click, 1300, 975 ; this clicks on the next video button, under the video frame on the right
- Sleep, sleepLong ; wait for a longer time (giving page a chance to load)
- Click, 1100, 620 ; this clicks on the center of the video area to start playback
- Sleep, sleepLong ; wait for a longer time (giving page a chance to load)
- Click, 1561, 872 ; this clicks on the full screen button to make video full screen.
- ;
- ; Once video is playing, as long as you keep the video window focused, you can hit spacebar to pause or restart playback.
- Return
- #IfWinActive
- ;===== FUNCTIONS ===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement