Mac Chrome Udemy Applescript

[Solved] Mac Chrome Udemy Applescript | Perl - Code Explorer | yomemimo.com
Question : mac chrome udemy applescript

Answered by : ian-d76lct74ks41

// AppleScript (Mac) to Rwd/Fwd Skip 5s in Udemy videos on Chrome
to clickControlBtn(btnDataPurpose)	tell application "Google Chrome" to (tabs of window 1 whose URL contains "udemy")	set udemyTab to item 1 of the result	tell application "Google Chrome"	execute udemyTab javascript "document.querySelector('" & btnDataPurpose & "').click();"	end tell
end clickControlBtn
-- rewind skip 5s (only consistent query selector I found for button)
clickControlBtn("button[data-purpose*=rewind]")
-- forward skip 5s
-- clickControlBtn("button[data-purpose*=forward]")
// To setup a Service Quick Action on ur Mac
// 1. Open 'Automator' app
// 2. Create new 'Workflow' select 'Run AppleScript' (search name)
// 3. Paste above code into AppleScript editor (over template)
// 4. Run the code to test it, Save file and create keyboard shortcut
// 5. Systems Preference > Keyboard > Shortcuts > General
// - I used Alt+Cmd+ L/R arrows or select a combo you like
// just make sure they dont conflict say with VS Code key bindings
// otherwise they wont work
// 6. Repeat step for 'Forward Skip 5s' if you want, just make sure to
// uncomment/comment 'clickControlBtn()' function respectively.
// - Fyi, comments in AppleScript use -- not // like in JS
// Notes:
// - This only works if the Udemy tab is on the last active window
// Cmd + Tab to switch apps, Cmd + ` to switch chrome windows
// - Solution lags a bit, but you get to keep ur fingers on ur keyboard

Source : | Last Update : Fri, 02 Sep 22

Answers related to mac chrome udemy applescript

Code Explorer Popular Question For Perl