2

I want to have a key combo to refresh active window in Google Chrome, which normally would be Cmd + R. Keep in mind that (a) I am using two screens, (b) Google Chrome is not presently active window.

Is it even possible?


I am trying to bind this script https://gist.github.com/51b459e5e93210f37e24 with hot-key. What I did is: created a service using Automator (no input, any application). Using services hot key, I've set cmd+r. However, that doesn't do anything.

My expected result is: cmd+r does what it should already do in the present app + executes my apple-script.

3 Answers 3

3

You can put either of these in an Automator service using a applescript Action.

Then set a keyboard shortcut with the Services in keyboard system preferences's Keyboard Shortcuts.

Note the 'Service receives' settings in the screen shots. This will make sure the Menu appears in all app's services. (The other apps may need to quit and re open before they pick up the short cut)


Chrome.

tell application "Google Chrome"
    reload active tab of (get window 1)
end tell

enter image description here


Safari.

tell application "Safari"
    tell document 1 to do JavaScript "javascript:location.reload(true)"
end tell

enter image description here


Services.

enter image description here


Service Menu -In iTunes

enter image description here

7
  • Tried. Didn't work. Even tried to restart computer. The shortcut does work only in the Automator environment.
    – Gajus
    Feb 18, 2012 at 23:45
  • @Guy It works here. Did you go to the Services in keyboard system preferences's Keyboard Shortcuts. Look for the service there and double click to the right hand side to add short cut. Make sure its tick
    – markhunte
    Feb 19, 2012 at 0:56
  • Oh, in Keyboard settings. Missed this bit. Thank you, it works.
    – Gajus
    Feb 19, 2012 at 0:58
  • At the end it didn't work. I thought it works because it work in Keyboard settings environment. I've tried setting the same thing in Code services hot keys settings, but that didn't work either. I ended up downloaded QuickKeys.
    – Gajus
    Feb 19, 2012 at 1:04
  • @Guy Are you seeing the Actual Service in the Service Menus of the other apps. And if you are do the show the short cuts. See the new image I have added.
    – markhunte
    Feb 19, 2012 at 2:28
0

Well, you could do this over an AppleScript that does this:

tell application "Google Chrome" to activate
tell application "System Events"
    keystroke "r" using command down
end tell

and then invoke that script over a shortcut. There are some free apps out there that do this job; Mac OS X doesn't offer this, I'm afraid.
(Maybe you have to replace "Google Chrome" with the actual name of the Chrome app; I don't have it installed, so I can't check what its name is.)

1
  • How do I actually bind this to the hot key?
    – Gajus
    Feb 18, 2012 at 22:50
0

I recommend using an extension to auto-reload tabs. This is not excatly what you ask for, but it accomplishes the same goal.

  • Chrome: Easy Auto Refresh

    • Auto-refresh and auto-reload pages after any number of seconds.
    • Set different delays per page or tab.
    • Remembers your settings per page.
    • Remembers web page scroll position.
  • Safari: Safari Tab reloader

    • Remembers vertical and horizontal scroll positions for reloaded pages
    • Automatically pauses reloading on pages you have entered text on (so you won't lose your work)
    • Allows you to enable or disable reloading for individual tabs, or for all the tabs in a window
  • Firefox: ReloadEvery

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .