Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Created February 5, 2020 17:45
Show Gist options
  • Save tomhodgins/031dc82b933051b84c76ebe06291b65b to your computer and use it in GitHub Desktop.
Save tomhodgins/031dc82b933051b84c76ebe06291b65b to your computer and use it in GitHub Desktop.
Use this with Apple's Script Editor to refresh the Chrome web browser and execute whatever is on your clipboard as JS
var app = Application('System Events')
app.includeStandardAdditions = true
var browser = Application('Chrome').windows[0].activeTab()
// Chrome
browser.reload()
function loadEnd(callback) {
return browser.loading()
? loadEnd(callback)
: callback()
}
loadEnd(e => browser.execute({javascript: app.theClipboard()}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment