Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I work in a double screen environment where I write code on one screen and preview the results in the other (containing Firefox, Chrome etc.).

It would be great if I could somehow make the browser window refresh without manually switching to the browser. So while I write code, I would like to push, for example, Ctrl+Alt+R and the browser window would refresh without any extra effort on my side.

Is there any software that could help me to set up such custom hotkey?

share|improve this question
add comment

2 Answers

If you use AutoHotkey, I have written a script that will refresh the specified open browsers and return you back to your original window. This uses the hotkey CTRL+ALT+R, as per your example.

^!r::

; Save current window
WinGet, original, , A

; ---------------------------------------

; Refresh Firefox
Process, Exist, firefox.exe
    If(ErrorLevel) {
        WinActivate, ahk_pid %ErrorLevel%
        Send {F5}
    }

; Refresh Chrome
Process, Exist, chrome.exe
    If(ErrorLevel) {
        WinActivate, ahk_pid %ErrorLevel%
        Send {F5}
    }

; Refresh Internet Explorer
Process, Exist, iexplore.exe
    If(ErrorLevel) {
        WinActivate, ahk_pid %ErrorLevel%
        Send {F5}
    }

; ---------------------------------------

; Return to original window
WinActivate ahk_id %original%

You can add as many browsers as you like, just copy the format above. All you need to know is the process name, which can be found using Task Manager.

share|improve this answer
add comment

I don't think that that is possible mainly because keystrokes (a vast majority of the time) are only sent to the active window. Unless you somehow connect Firefox or Chrome to the program you’re using to write your code, then there really isn't a way to have one program read a keystroke from another program.

However, you may not need to refresh the page (in the traditional sense). If the file path doesn't change, you could have a chrome shortcut opening that specific file path, and then just have a Windows keyboard shortcut going to that file.

(Because the keyboard shortcut would be a windows shortcut, and not application specific (it can work within programs), it would work within your programs.

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.