- Some rely on fetching file information.
- Some allow you to use a browser extension.
- Some only work on Mac.
- Some only work in single browser (when they do at all).
A bit of a trouble, isn't it? For most purposes, it'd suffice to check for file time change and refresh the page in the browser. So might as well do that with help of AutoIt.
It doesn't take much to accomplish the effect:
$time1 = "" While 1 $time0 = $time1 $time1 = fileGetTime("C:/Temp/NewProject/bin/NewProject.js", 0, 1) if ($time1 <> "") and ($time0 <> $time1) then consoleWrite("Update: " & $time1 & @CRLF) $p = winGetHandle("[ACTIVE]") ; get current active window controlSend("New Project - Google Chrome", _ ; window title "", "", _ ; component "^r") winActivate($p) ; switch back to current active window endif sleep(500) wend
How to use it:
- Open your desired JS+HTML application in a (preferably separate) browser window
- Enter window title text into code (you can guess where it goes by a comment saying "window title")
- Enter "changing" file's location into code (if you are working on game, it's probably the main .js file)
- Run the script (F5 if you are using the customized SciTE that comes with AutoIt)
- Now, whenever the file is modified, script will refresh the browser tab, ensuring that it is of current version.
- Once done with it, terminate the script (either via SciTE, or by adding a exit hotkey to code)
If you require watching multiple files, you can modify this to have multiple time-variables or an array of paths+times.