Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

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

share|improve this answer
    
Tried. Didn't work. Even tried to restart computer. The shortcut does work only in the Automator environment. –  Guy Feb 18 '12 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 '12 at 0:56
    
Oh, in Keyboard settings. Missed this bit. Thank you, it works. –  Guy Feb 19 '12 at 0:58
    
your welcome. :-) –  markhunte Feb 19 '12 at 1:01
    
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. –  Guy Feb 19 '12 at 1:04
show 3 more comments

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.)

share|improve this answer
    
How do I actually bind this to the hot key? –  Guy Feb 18 '12 at 22:50
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.