Last active
August 29, 2015 14:15
-
-
Save phpdave/03d23ccdb883e3b61a98 to your computer and use it in GitHub Desktop.
Simple script to refresh browser when you save a file in netbeans. You could modify the script to do even more advanced things if your proficient in AHK.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment