Have you ever wanted to refresh your browser after saving a file? Well now you can with this simple AutoHotKey script that detects if Netbeans is active, then activates firefox and sends CTRL + R to the browser and then returns to Netbeans. You can modify the script to your needs.
;Bind to CTRL+S key | |
~^S:: | |
;If Netbeans is active (SunAwtFrame) is a class, you could change this to the actual title but you'll have to update the script more often | |
IfWinActive, ahk_class SunAwtFrame | |
{ | |
;Msbox for debugging purposes. ; is used to comment it out | |
;MsgBox NetBeans Active | |
;Activate Firefox | |
WinActivate, ahk_class MozillaWindowClass | |
Sleep, 333 | |
;Reload browser | |
Send, {Control Down}{r}{Control Up} | |
WinActivate, ahk_class SunAwtFrame | |
} | |
else | |
{ | |
;Turn this back on if your having troubles | |
;MsgBox NetBeans not active | |
} | |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
#SingleInstance force | |
CoordMode, Mouse, Window | |
SetTitleMatchMode 2 | |
DetectHiddenWindows On | |
#WinActivateForce | |
SetControlDelay 1 | |
SetWinDelay 0 | |
SetKeyDelay –1 | |
SetMouseDelay –1 | |
SetBatchLines –1 | |
^r:: | |
Reload ; Assign Ctrl-R as a hotkey to restart the script. | |
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached. | |
MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing? | |
IfMsgBox, Yes, Edit | |
return | |
Esc:: | |
;Suspend | |
;I think I want to suspend instead of killing the script completely and requiring a reload | |
ExitApp |
You can download the exe here. https://drive.google.com/file/d/0B7SPOU6Yj_ubcUFDX0tiSFBOLTQ/view?usp=sharing
If you want to run the script yourself without downloading an exe you’ll have to install autohotkey