Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AHK BBCodeWriter v7.0.2 - An offline BBCode Editor


  • Please log in to reply
65 replies to this topic
AGermanUser
  • Members
  • 82 posts
  • Last active: Apr 07 2010 06:06 PM
  • Joined: 12 Feb 2005

SetBBCodeTags("[b]","[/b]", BoldPressed)

Oh man, I'm so stupid. Posted Image
thx toralf. Didn't see the mistake despite looking over this passage a hundred times.

Made another update where I added your code simplification.

Added also a "hidden" credits gui. ;) Tell me what you think about it, in case you find it. :lol:
It's not too hard to find it. :mrgreen:

polyethene
  • Administrators
  • 5511 posts
  • Last active: Today, 07:33 PM
  • Joined: 26 Oct 2012
Another feature could be an automatic popup for your BBCodeWriter, e.g.
SetTitleMatchMode, 2

SetTimer, PostingReplyCheck

;...

Return



PostingReplyCheck:

IfWinExist, Post a reply - Microsoft Internet Explorer

	Gui, Show

Return


AGU
  • Guests
  • Last active:
  • Joined: --
I'm not sure if I understand what you mean. Does your code mean that the BBCodeWriter window get activated if it looses focus after pressing "Preview"?

That's the reason why I added this "Pin" button on the upper right corner. It makes the main window of BBCodeWriter "AlwaysOnTop". Therefore the browser window can't hide it.

polyethene
  • Administrators
  • 5511 posts
  • Last active: Today, 07:33 PM
  • Joined: 26 Oct 2012
Thats the thing, instead of the window being always on top or having to manually activate the window when you need it, it would be a good addition if the window automatically popped up when it detected that a forum was being used (e.g. by IfWinExist, Post a reply).

polyethene
  • Administrators
  • 5511 posts
  • Last active: Today, 07:33 PM
  • Joined: 26 Oct 2012
Another useful option would be automatic url reference to ahk command names. Run the following script to get a list of hotstrings:

RegRead, inst, HKLM, SOFTWARE\AutoHotkey, InstallDir
dest = %temp%\AHK-docref.txt
FileDelete, %dest%

FileRead, f, %inst%\Extras\Editors\Syntax\CommandNames.txt
StringReplace, f, f, `r, , 1
Loop, Parse, f, `n
	If A_LoopField
		FileAppend, :*:%A_LoopField%`::[url=http://www.autohotkey.com/docs/commands/%A_LoopField%.htm]%A_LoopField%[/url]`r`n, %dest%
Run, notepad %dest%


AGU
  • Guests
  • Last active:
  • Joined: --
Sorry for my late answer. :oops:

After readling your lines again I finally understood what you meant with that "automatic popup" feature. You mean BBCodeWriter is running all the time, and when a user tries to post a message or create a new thread, BBCodeWriter should popup to let the user write his posting, right?

Hmm, does it affect system performance when the script is running all the time with the timer checking for a new browser window?
Does the window title always contain "Post a reply - ..." in a standard installation of phpbb? And since BBCodeWriter has no tray icon how would you hide the BBCodeWriter window so that it's not bothering the user. I know some users that get bothered by minimized windows in the taskbar. Or should there be a tray icon?
And what about other languages e.g. german? A german forum won't have "Post a reply -" in the window title , will it? How would you solve that language issue?

Apart from this it's a great idea. I'm thinking about making the "window title recognition" in some way configurable. Any idea? There's plenty of room in the "Preferences" Gui. ;) :mrgreen:


Concerning "automatic url reference": That would be a very special thing for AHK users. How do you think this should work? A user enters an AHK command and it is converted to an url linking to the website of that command?
I think AHK commands are mainly noted inside the code tags. But inside code tags URLs don't work. I checked that. So how would you use this feature? Tell me more :mrgreen:

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Great script! I was looking for some code to ease inputing BBCode in these little textareas, since stupid phpBB script always append the codes at the end of the area instead of inserting them where the caret is.
Your program is even better! I like the preview.
And this is an impressive example of GUI by AHK.

I wanted to test with a post I was writting, and the preview was awful, with font becoming suddently big and overlaid.

I found it was because I wrote some raw HTML codes: "

ends when meeting

,
    ".

    So I added three lines before the bold formatting:
      ; Convert HTML sensitive chars ###############################################
      StringReplace, bbcode, bbcode, &, &`;, All
      StringReplace, bbcode, bbcode, <, <`;, All
      StringReplace, bbcode, bbcode, >, >`;, All
    

    I also added a `n after
    so view source is nicer.

    I might prefer to insert starting and ending tag at once, and put the caret between. I will see that.
    Also I can exit after doing changes, perhaps it should ask to save before, if possible. Not if text has been changed or copied with the button.

    Excellent work!


AGU
  • Guests
  • Last active:
  • Joined: --
Thx for your nice compliments. :D

So I added three lines before the bold formatting:

Makes sense. I'll add these in a next version 5.6

I also added a `n after
so view source is nicer

I consider adding these too. I just have to check in different browsers if empty lines within HTML code affect the correct displaying of the preview page.

I might prefer to insert starting and ending tag at once, and put the caret between.

Hmm, I see what you mean. That's rather hard to add within the script. But of course you can edit the source ahk files to accompolish this.
Just have a look at the "SetBBCodeTags" function. You just have to replace
If (In_BtnVariable = 0)
          {
            In_BtnVariable++
            Return, %In_StartTag%
          }
        If (In_BtnVariable = 1)
          {
            In_BtnVariable--
            Return, %In_EndTag%
to s.th that fits your needs. E.g.

Return, %In_StartTag%%In_EndTag%
Of course you have to do a StringLen on the In_EndTag to get the number of characters because the length can vary between the different tags.
In the end just Send, {Left %LengthOfEndTag%} and you're done I think.

Also I can exit after doing changes, perhaps it should ask to save before, if possible.

Good idea. I'll think about it and will have a look how to accomplish this. :D

Cheers
AGU

AGermanUser
  • Members
  • 82 posts
  • Last active: Apr 07 2010 06:06 PM
  • Joined: 12 Feb 2005
So, after some hours of work I added all your proposed features. :mrgreen:

I changed the entering of BBcode Tags to your proposed system (pasting both tags and moving caret) cause I found it much better than before. In this way I can do it without all this xxxxPressed variables.

Further details can be found in the updated first posting.

Cheers
AGermanUser a.k.a AGU

EDIT
btw:
I'm still looking for a better icon instead of this little smiley in the title bar. I made this smiley in a rush. I'm looking for a better icon that looks good at 16x16pixel as well as with 32x32pixel and goes in line with AHK BBcodeWriter. Any suggestions?

brian32
  • Guests
  • Last active:
  • Joined: --
This is one of the best and most useful AHK scripts I've seen. Thanks very much for sharing it and updating it!

I have run into one problem though. Html and xml statements within bbcode's code tags do not display properly when previewed. I presume that the '<' characters are the culprit. It has not been a hinderance but it would be nice if that worked properly. Maybe this could go onto the list of improvements for a future version.

Thanks once again.

brian32

AGermanUser
  • Members
  • 82 posts
  • Last active: Apr 07 2010 06:06 PM
  • Joined: 12 Feb 2005
thx brian32. :D

I have run into one problem though. Html and xml statements within bbcode's code tags do not display properly when previewed. I presume that the '<' characters are the culprit.

I updated the script to version 5.6.1 and hopefully fixed that issue. See updated first posting.

Could you give it one more try and report back if it's okay now? Maybe there are more HTML/XML sensitive chars that need to be taken care of.

brian32
  • Guests
  • Last active:
  • Joined: --
AGU that was a fast response! It looks like it is working fine now previewing XML and HTML code.

Thanks again for a great script.
brian32

twhyman
  • Members
  • 348 posts
  • Last active: Jun 08 2013 09:10 PM
  • Joined: 07 Dec 2005
hi,

when i try to run the script i get and error on line 125 " call to non existent function"

btw the directoy of the icons is the root dir not in phpbb if that makes any differnce.

iam trying to learn how to make buttons with graphics :)

i have found the graphic buttons script from corrupt

but i really wanna use that editor :D

thanks
Twhyman

AGU
  • Guests
  • Last active:
  • Joined: --
Hello, twhyman

I think you tried to run "BBCodeEditor.ahk". But this is wrong. As the instruction in the first posting states out:

Simply extract the zip file to a folder and run "main.ahk".


You just have to extract the downloaded zip file to a directory of your choice and run "main.ahk" inside of this directory.

main.ahk includes all files with the help of the #Include directive. It includes for example the "functions.ahk" which holds the function used inside BBCodeEditor.ahk.
So when you run BBCodeEditor.ahk on its own it can't find that function and reports the error "Call to non existent function"

btw. when you extract the zip file you have to tell your zip program to obey the included paths within the zip file. Normally you won't have to pay attention to this. Your zip program should do that automatically. I wrote it just in case you're still having problems after this posting.

The directory has to look like this after unzipping:

Your folder 
  + phpbb
    + ico             (icons for main gui)
      + smileys       (icons for smiley gui)
    + images          (images for html preview page)
    + smileys         (smiley images for preview page)
      BBCodeEditor.ahk
      BBCodePreview.ahk
      color.gif
      style.css
  + postings          (folder will be created at first script start)
  + text              (text files for help menu in menu bar - main gui)
    BBCodeWriter.ini  (config file - holds displayed number of lines in main.gui)
    functions.ahk     (used functions)
    hotkeys.ahk       (used hotkeys)
    main.ahk          (this is the start script - this has to be executed to run BBCodeWriter)
    preview.html      (file will be created when pushing "preview" button within main gui)

Hope that helps :mrgreen:

Cheers
AGU

Ace_NoOne
  • Members
  • 299 posts
  • Last active: May 02 2008 08:19 AM
  • Joined: 10 Oct 2005
Wow, pretty elaborate work there - thanks for sharing!

Just a minor suggestion to avoid losing the clipboard content (this might have come up already, I haven't read all replies here):
OnExit, quit

clipboardOld := clipboard ; backup clipboard contents (using ClipboardAll here might result in excessive memory use)
clipboard = ; flush clipboard

[...]

quit:
	clipboard := clipboardOld ; restore clipboard contents
	ExitApp
Return
(I just noticed there's an example in the documentation that's pretty much exactly the same as my suggestion here - d'oh!)