3 ms·
"If you're on macOS, you can do a small piece of this natively with AppleScript (or anything that can send apple events) in Chrome or Safari -- namely, you can
by pmoriarty 4y ago
"If you're on macOS, you can do a small piece of this natively with AppleScript (or anything that can send apple events) in Chrome or Safari -- namely, you can iterate through windows or tabs, view their source code, and execute arbitrary javascript you pass (there's a one time security option you have to accept). This can be handy for quick automations if you don't want to install anything."
Are there any good examples of doing this?
- phillco 4y agoI believe I modified a version of this - https://gist.github.com/lyallcooper/10f48ab050ac8594fe46335e49c99c46 https://gist.github.com/lyallcooper/10f48ab050ac8594fe46335e...
- cpleppert 4y agosure, for example this pauses every youtube video in every chrome tab: tell application "Google Chrome" repeat with theWindow in every window repeat with theTab in (every tab of theWindow) if (URL of theTab) contains "youtube.com" then execute theTab javascript "document.querySelectorAll('video, audio').forEach(e => e.pause())" end if end repeat end repeat end tell There are lots of examples just by googling. The script editor has a dictionary for every application you can natively script.
- deleted 4y ago[deleted]