Wow! This is great! Thanks!
I made some cool modifications to make the preview
Live Updating
Now it's
TOTALLY AWESOME!! (ok, maybe just a little more awesome than before
)
This is really cool for having the edit window in the front, with the preview right behind it. You get an instant look at what your post will look like,
Without ever leaving the editor.
To change it, in short, I:
[*]Added a g-label to the main edit control
[*]Created a label that calls the preview at a max rate of .5 second
(there were problems with not giving it breathing room)
[*]Changed the winactivate and refresh part to use ControlSend if it's a live update, and not activate the window.
(the preview button still works normally)
Code:
; ### 1 ###
; In \phbb\BBCodeEditor.ahk ~line#476 Added: gEdtChange
Gui, 1:Add, Edit, vEdtComment gEdtChange +WantTab -Wrap +HScroll xs y%EdtY% h%EdtH% w%EdtW% Section
; +WantTab is handy for editing code in BBCodeWriter
; -Wrap and +HScroll changes it so lines don't wrap, and if they go beyond the control width, you can scroll instead of having to select text or use the arrow keys for getting there. just a personal prefrence.
; ### 2 ###
; in \phbb\BBCodeEditor.ahk ~line#2294 Added label: EdtChange
EdtChange:
If LiveUpdate
return
IfWinNotExist, BBCodeWriter Preview ;it only Updates the preview, doesn't create it.
return
LiveUpdate = 1
SetTimer, BtnPreview, -500 ;don't forget the "-" !!
return
; I could have had it update immideately on a change instead of having it wait another half second,
; but this way it gives the user more time to type a couple letters if that's all that's being changed.
; ### 3 ###
; in \phbb\BBCodePreview.ahk ~line#503 changed If block:
; Check whether BBCodeWriter already created a browser window
IfWinExist, BBCodeWriter Preview
{
If LiveUpdate
ControlSend, Internet Explorer_Server1, {F5}, BBCodeWriter Preview
Else
{
WinActivate, BBCodeWriter Preview
Send, {F5}
}
}
Else
{
; Run defined browser with preview page
Run, %BrowserExe% "%A_WorkingDir%\preview.html"
WinWait, BBCodeWriter Preview
WinActivate, BBCodeWriter Preview
}
LiveUpdate = 0
Return
I'm sure there are better ways to implement it. (e.g. Using GuiControl to enable/disable g-label)
Unfortuneately, it flashes some every time it refreshes, and worse if it's scrolled down some. I wouldn't think there is a fix for that, it's just natural.
I strongly suggest using:
C:\WINDOWS\system32\mshta.exe as the previewer, as AGermanUser says. Since it is updating very frequently, speed and low resources are a priority.
I've noticed a bug: if the system is bogged down, live update sometimes opens a couple blank mshta windows.
This would be really great to build in. Maybe a checkbox somewhere like:
[_] Live Update the Preview Window
or something, so you can turn it off if you don't want it.
What do you think?