AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AHK BBCodeWriter v7.0.2 - An offline BBCode Editor
Goto page 1, 2, 3 ... 16, 17, 18  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
AGermanUser



Joined: 12 Feb 2005
Posts: 81

PostPosted: Thu Nov 03, 2005 12:54 am    Post subject: AHK BBCodeWriter v7.0.2 - An offline BBCode Editor Reply with quote

Welcome to the presentation of my Offline BBCode Editor skript based on Autohotkey script language. Mr. Green



Description:

It's a small BBCode Editor that lets you write a forum posting offline including all bbcode formatting options. Other features:
  • Save and load your postings.
  • Resizable GUI.
  • Add signatures to your postings. (possible workaround for 255 char limit within some boards.)
  • Supports language english/german via Ini file. Create your own language file and simply copy it to the 'lang' subfolder.
  • Preview mode to see how your posting will look like.
  • Support for ten user-defined BBCodes.
  • F-Key (F1, F2, ...) Hotkeys for easier formatting. Including well known Alt hotkeys from phpbb.
  • Tag compose mode - add more than one bbcode tag by using Ctrl key

At the moment the script is specialised for the phpbb forum, but it can be adjusted for any other forum.
Due to using RegEx inside the script, your version of Autohotkey has to be 1.0.46+ when you want to use the source files.

If you have created a language file on your own, feel free to share it with the community. I'll add it to a future release if you're interested.

Tag compose mode:
Some words about the new compose mode. Imagine you want to apply more than one tag at once - make use of the Ctrl key.
E.g. you want a word bold and italic formatted. Highlight the word, press Ctrl, press the bold button, release the Ctrl key and press italic button. Voilà. This also works without highlighting a word. In this case the caret is moved inside the tags to start writing.

As long as you hold the ctrl key, the tags are copied to clipboard. The first button press without holding the Ctrl key will paste the collected tags.
Give it a try. Smile

Preview:
The user d-man discovered a way to speed up displaying of the preview window. Instead of using a browser as preview application he proposes to use MSHTA.exe within your windows\system32 folder. MSHTA loads much faster than any browser window.

In order to use MSHTA.exe simply open preferences via File Menu and specify C:\Windows\system32\MSHTA.exe as your prefered browser.

Enclosed Hotkeys:
  • F1 - Bold
  • F2 - Italic
  • F3 - Underline
  • F4 - Quote
  • F5 - Code
  • F6 - URL
  • F7 - Unordered List
  • F8 - List Element
  • F9 - FontColor
  • F10 - Image
  • F12 - Smileys


Some further details can be found on the new AHK BBCodeWriter documentary homepage:
Arrow AHK BBCodeWriter Homepage


Download & Installation:

You can it download it here:
Arrow BBCodeWriter v7.0.2 Compiled + NSIS Installer
Arrow BBCodeWriter v7.0.2 Sourcecode

Old version
BBCodeWriter v6.6 Compiled + NSIS Installer
BBCodeWriter v6.6 Sourcecode

Attention: Some users reported that BBCodeWriter contains a virus. This is a false postive from your virus scanner. Let me assure you BBCodeWriter is free of viruses. Your scanner reports a virus because of Autohotkey using upx.exe.

Exclamation Sourcecode:
Simply extract the zip file to a folder and run "main.ahk". Mr. Green

Exclamation NSIS Installer:
I created a new NSIS installer. The small bug of the former installer is fixed. If you don't want a start menu entry, simply uncheck the corresponding box during install.

The new installer also creates an entry within your control panel's software list. In this way you can uninstall AHK BBCodeWriter very easily. It also comes with an uninstall.exe. Uninstalling AHK BBCodeWriter doesn't delete the programs folder including all your signatures and saved postings. If you want to get rid of them too, simply delete the remaining folder in your explorer.


The Scripts:

Take a look at the scripts if you like:
Changelog:

18.05.2007
+ fixed bug in RenameHelper routine - wrong highlighting when 'Hide known extension' is active (thx cuzabis)
16.05.2007
+ fixed bug in BBCodePreview.ahk - BBCode tags within url tags weren't displayed (thx Pastilhas)
24.04.2007
+ fixed minor typo in HandleMessage function - functions.ahk
+ added the hotkeys known from within the phpbb software - hotkeys.ahk
+ updated BtnEditSig subroutine - editing signatures sets window title; easier saving with Ctrl+S - BBCodeEditor.ahk
+ updated BtnUrlDesc subroutine - highlighted text within EdtComment is used as link text (thx roundtrip)
+ updated GuiClose subroutine - Use GuiControlGet instead of ControlGetPos - Use associated variable instead of ClassNN
+ updated ChkSig, ShowTip and RebuildGui1 suboutine - use controls' assosciated variables instead of ClassNN
+ replaced old 'IfWinActive' method within hotkeys with #IfWinActive directive - BBCodeEditor.ahk
+ several cosmetic indentation changes inside main.ahk, BBCodeEditor.ahk, functions.ahk
+ updated Titans Anchor function to v3.4.2
+ added 'Default' option to 'Submit' button within FontGUI
+ added Custom BBCode button bar - can be deactivated under 'Preferences'
+ added ComposeMode capabilities for Custom buttons
+ updated HandleMessage function to support more than one URL inside About GUI
+ added Ctrl-Shift-End hotkey for restoring BBCodeWriter.ini - hotkeys.ahk
+ fixed list bug in BBCodePreview.ahk - wrong parsing in case of more than one 'not-nested' list (thx SLMB)
+ updated AboutGUI - Link to BBCodeWriter thread changes depending on the used language
+ added "Clear history" button to 'Preference GUI' - clears list of recent files in File Menu
22.08.2006
+ added another part to statusbar - shows used tags within ComposeMode
+ removed drag&drop support - too many side effect/bugs - sorry for that
+ updated MsgBox when exiting script - clipboard won't be restored anymore
+ added 'Check for updates' option to HelpMenu
+ fixed BtnSend subroutine - Window lost WinTitle when pushing 'Copy' button (thx roundfile)
20.08.2006
+ changed preview.html in BBCodePreview.ahk - new logo to get smaller header (thx Mart)
+ fixed some minor errors in html code and style.css
+ using #IfWinActive directive inside hotkeys.ahk instead of old method
+ removed "clipboard flush" when starting the script - disadvantages outweighed the benefits
+ added drag&drop support for edit control (thx laszlo)
+ updated "Credits GUI"
+ updated OpenRecentFile subroutine - shows error if file cannot be found/was deleted
+ updated FontSize GUI - easier formatting with buttons instead of DropDownList - similar to ColorGUI
18.07.2006
+ fixed bug in 'SavePosting' subroutine (Ctrl+S) - Gui1 title length not hardcoded anymore (thx jballi)
06.07.2006
+ updated compose mode - control key (Ctrl) is now magic key for compose mode


Please post any errors you find because the script may be buggy. Smile (especially the preview routine)
_________________
Cheers
BBCodeWriterToDo-ListCopyPassage


Last edited by AGermanUser on Wed Jun 25, 2008 10:23 am; edited 54 times in total
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5438
Location: /b/

PostPosted: Thu Nov 03, 2005 1:04 am    Post subject: Reply with quote

Good script. I like the preview option.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Thu Nov 03, 2005 9:58 am    Post subject: Reply with quote

Hi AGU,

Very nice job. Well structured and documented.
I found one thing in the main.ahk that might at some point cause trouble:
Code:
; Include script for creating HTML Preview
#Include functions.ahk
#Include %A_ScriptDir%\phpbb\BBCodeEditor.ahk
#Include %A_ScriptDir%\phpbb\BBCodePreview.ahk

; Create Main Window
GoSub, CreateMainGui
Return
You are lucky, because functions.ahk and BBCodePreview.ahk only contain functions but no auto-exec-section with a return.
Because I'm sure that the last gosub is never executed. Test it with
Code:
; Create Main Window
MsgBox, Am I right?
GoSub, CreateMainGui
Return
Your auto-exec-section stops inside the BBCodeEditor.ahk, because it contains a return after the CreateMainGui routine.

To prevent future misbehavior you should reorganize the lines to:
Code:

;execute autoexec of BBCodeEditor.ahk
GoSub, AutoExecBBCodeEditor
;*** you need to add a RETURN in the file after the autoexec section ***

; Create Main Window
GoSub, CreateMainGui
Return
; end of auto exec

; Include script for creating HTML Preview
#Include functions.ahk
AutoExecBBCodeEditor:
#Include %A_ScriptDir%\phpbb\BBCodeEditor.ahk
#Include %A_ScriptDir%\phpbb\BBCodePreview.ahk
Or something like that. Maybe even taking the autoexec section part from BBCodeEditor.ahk into the main.ahk script.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
AGU
Guest





PostPosted: Thu Nov 03, 2005 1:23 pm    Post subject: @toralf Reply with quote

Quote:
Because I'm sure that the last gosub is never executed.
I see your point. You're right.

Quote:
Maybe even taking the autoexec section part from BBCodeEditor.ahk into the main.ahk script.
I placed that section there, because I wanted some kind of modular design. In case someone wants to adjust the script for his/her favorite forum/board you just have to create another folder in %A_ScriptDir%, copy "BBCodeEditor.ahk" and "BBCodePreview" in that new folder and change the #Include Directive in the main.ahk script.
This is the reason why I moved the code to "BBCodeEditor.ahk". Cause the button variables, Font colors, FontSizes are phpbb specific.

Therefore I would prefer your first solution and would add another label "AutoExecBBCodeEditor" in BBCodeEditor.ahk. What do you think about it? And what about that design/modular thing?
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Thu Nov 03, 2005 3:46 pm    Post subject: Reply with quote

I like the design, moduls, nameing conventions, comments, indentation. I could read the code easily.

The only thing I could spot is that the section on BtnAddSmileyXX actions could be easily simplified.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
roundfile



Joined: 03 Nov 2005
Posts: 6

PostPosted: Thu Nov 03, 2005 4:12 pm    Post subject: Reply with quote

Hi AGU,

This is an excellent and very useful script! Thank you for sharing it. Very Happy

I wanted a larger edit window so I made the following changes to make the height of the edit window configurable. There may be a better way to do the same thing but this may be a worthwile enhancement.

To main.ahk is added
Code:
;Number of rows (lines) displayed in the edit window
NumEditRows = 25

BBCodeEditor.ahk is modified to be:
Code:
  Gui, Add, Edit, vEdtComment xs ys+30 r%NumEditRows% w600 Section
 
  OffsetLowerBtns := (NumEditRows+1) * 13
 
  Gui, Add, Button, gBtnSend xs+238 ys+%OffsetLowerBtns% w60, &Copy


Thanks again, this is a wonderful script!

-roundfile
Back to top
View user's profile Send private message
AGU
Guest





PostPosted: Thu Nov 03, 2005 9:59 pm    Post subject: Reply with quote

@roundfile
Quote:
I wanted a larger edit window so I made the following changes..
I like your idea. Smile I'll add your code to the script. Maybe I'll add another menu entry "preferences" and a gui that lets the user change the number of rows by saving it to an ini file. I'll have a look on this. Very Happy

@toralf
Quote:
The only thing I could spot is that the section on BtnAddSmileyXX actions could be easily simplified.

Do you mean it that way?

Code:
; List of Smileys for Smiley GUI
ListOfSmileys = :D.:).:(.:o.:shock:.:?.8).:lol:.:x.:P.:oops:.:cry:.:evil:.:twisted:.:roll:.:wink:.:!:.:?:.:idea:.:arrow:.:|.:mrgreen:
StringSplit, ArrayOfSmileys, ListOfSmileys, .

Code:
BtnAddSmiley1:
  SmileyNumber = 1
  GoSub, AddSmiley
Return

Code:
AddSmiley:
  Smiley = ArrayOfSmileys%SmileyNumber%
  Clipboard := %Smiley%
  Gui, 1:-Disabled
  Gui, 4:Destroy
  GuiControl, 1:Focus, EdtComment
  Send, ^v
  Clipboard =
Return

Or dio you see a better/shorter way?
Back to top
AGU
Guest





PostPosted: Thu Nov 03, 2005 10:29 pm    Post subject: Reply with quote

@toralf
Code:
;execute autoexec of BBCodeEditor.ahk
GoSub, AutoExecBBCodeEditor
;*** you need to add a RETURN in the file after the autoexec section ***

; Create Main Window
GoSub, CreateMainGui
Return
; end of auto exec

; Include script for creating HTML Preview
#Include functions.ahk
AutoExecBBCodeEditor:
#Include %A_ScriptDir%\phpbb\BBCodeEditor.ahk
#Include %A_ScriptDir%\phpbb\BBCodePreview.ahk

Don't know why, but I doesn*t work.

Code:
;*** you need to add a RETURN in the file after the autoexec section ***

You mean BBCodeEditor.ahk, right? After adding a return after the autoexec section in BBCodeEditor.ahk running the script results in not appearing of the main gui.

Wouldn't deleting of
Code:
; Create Main Window
GoSub, CreateMainGui
Return
in main.ahk be a solution?
Back to top
AGU
Guest





PostPosted: Thu Nov 03, 2005 10:38 pm    Post subject: Reply with quote

Embarassed Embarassed Embarassed forgot to move
Code:
; Create Main Window
GoSub, CreateMainGui
Return

above the #Include directives.

Now it works. Very Happy
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Fri Nov 04, 2005 8:32 am    Post subject: Reply with quote

Code:
ListOfSmileys = :D.:).:(.:o.:shock:.:?.8).:lol:.:x.:P.:oops:.:cry:.:evil:.:twisted:.:roll:.:wink:.:!:.:?:.:idea:.:arrow:.:|.:mrgreen:
StringSplit, ArrayOfSmileys, ListOfSmileys, .
That is a good way, but I would use a Tab (or sometimg else, e.g. `n) to separate the items, since a . can be in a smiley. When you want to use a `n you can use a continueation section so that it is easy to maintain.

How about this: Only one routine for all smiley buttons?
Code:
...
  Gui, 4:Add, Button, gBtnAddSmiley vBtnAddSmiley1 xs ys+20 h22 w22 +%BS_ICON%
...

BtnAddSmiley:
  StringTrimLeft, SmileyNumber, A_GuiControl  12
  Smiley = ArrayOfSmileys%SmileyNumber%
  GoSub, 4GuiClose

  ;see remarks below
  GuiControl, 1:Focus, EdtComment
  Clipboard := %Smiley%
  Send, ^v
  Clipboard =
Return
Maybe use ControlSend, and I do not think you need Clipboard, the strings are short. Just set key delay low.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
AGU
Guest





PostPosted: Fri Nov 04, 2005 10:49 am    Post subject: Reply with quote

Quote:
... you can use a continueation section so that it is easy to maintain.
Can you tell me how to do it with a continuation section? I tried it, but it doesn't work for me.

Method #1 only works with "and", "or", ||, &&, a comma, or a period at the beginning of the line.
Method #2 has difficulties with the parantheses inside the smileys. Tried to escape the smiley parantheses - but doesn't work.

I like your solution with A_GuiControl and one routine for all buttons.
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Fri Nov 04, 2005 11:08 am    Post subject: Reply with quote

I meant method #2, I do not know what problem you mean with "difficulties with the parantheses inside the smileys"

this works
Code:
ListOfSmileys =
 (LTrim
    :D
    :)
    :(
    :o
    :shock:
    :?
    8)
    :lol:
    :x
    :P
    :oops:
    :cry:
    :evil:
    :twisted:
    :roll:
    :wink:
    :!:
    :?:
    :idea:
    :arrow:
    :|
    :mrgreen:
  )
StringSplit, ArrayOfSmileys, ListOfSmileys, `n
Loop, %ArrayOfSmileys0%
  {
    Item := ArrayOfSmileys%A_Index%
    String = %String%|%item%
  }
MsgBox, %ListOfSmileys%`n============`n%String%

_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Titan



Joined: 11 Aug 2004
Posts: 5438
Location: /b/

PostPosted: Fri Nov 04, 2005 12:32 pm    Post subject: Reply with quote

A richedit control would be nice for wysiwyg editing..
Back to top
View user's profile Send private message Send e-mail Visit poster's website
AGU
Guest





PostPosted: Fri Nov 04, 2005 12:37 pm    Post subject: Reply with quote

Quote:
I do not know what problem you mean with "difficulties with the parantheses inside the smileys"
Embarassed forgot LTrim within the parantheses.

Your code works well and it's definitely easier maintainable. Very Happy

Concering one routine for all smiley buttons:
Code:
...
Gui, 4:Add, Button, gBtnAddSmiley vBtnAddSmiley1 xs ys+20 h22 w22 +%BS_ICON%
...

BtnAddSmiley:
  StringTrimLeft, SmileyNumber, A_GuiControl, 12
  Smiley := ArrayOfSmileys%SmileyNumber%
  GoSub, 4GuiClose
  GuiControl, 1:Focus, EdtComment
  Control, EditPaste, %Smiley%, Edit1, %ScriptName%
Return

did it for me. I even hadn't to set key delay low. Control, EditPaste is obviously very fast with edit controls. Code is much shorter now, cause I could delete this whole bunch of BtnAddSmileyXX code blocks. Thanks again for this good tip. Very Happy
Back to top
AGU
Guest





PostPosted: Fri Nov 04, 2005 12:40 pm    Post subject: Reply with quote

@Titan
Quote:
A richedit control...
Haven't heard of this and can't find anything about it in the docs. Where can I find it?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3 ... 16, 17, 18  Next
Page 1 of 18

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group