topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 10:01 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Autohotkey added to geshi syntax highlighting feature on forum  (Read 17648 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Autohotkey has been added to the list of languages the forum knows how to color syntax highlight in posts.

To highlight code for a language, select the text and then choose the language from the "Code Highlighting" drop down combo box, on the Post form.

ps. thanks to dc member ewemoa for getting me to update to latest version of geshi that supports ahk; huge thanks to the geshi open source project.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #1 on: June 01, 2010, 07:30 PM »
Nice.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #2 on: June 01, 2010, 07:46 PM »
Thank you, mouser, for the update and your continued efforts  :Thmbsup:

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #3 on: June 01, 2010, 08:11 PM »
Thanks for taking the trouble to implement that!

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #4 on: June 01, 2010, 08:55 PM »
Thank you to both, mouser and ewemoa for their efforts.. :Thmbsup:

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #5 on: June 01, 2010, 09:00 PM »
all thanks should go to geshi -- i didn't do much more than download the latest zip file :)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #6 on: June 01, 2010, 09:15 PM »
following ewemoa's suggestion i made a meager $10 donation to geshi's sourceforge donation account on behalf of dc members.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #7 on: June 01, 2010, 09:35 PM »
Thanks :Thmbsup:

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #8 on: June 01, 2010, 09:48 PM »
Is there any way we can adjust the colours used for that AHK highlighter?  I much prefer the colours used for the AutoIt highlighter.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #9 on: June 02, 2010, 12:15 AM »
I'm comparing GeSHi's autoit.php with autohotkey.php:

autoit.php
Code: PHP [Select]
  1. 'KEYWORDS' => array(
  2.             1 => 'color: #0000FF; font-weight: bold;',
  3.             2 => 'color: #800000; font-weight: bold;',
  4.             3 => 'color: #000080; font-style: italic; font-weight: bold;',
  5.             4 => 'color: #0080FF; font-style: italic; font-weight: bold;',
  6.             5 => 'color: #F000FF; font-style: italic;',
  7.             6 => 'color: #A00FF0; font-style: italic;'
  8.             ),
  9.         'COMMENTS' => array(
  10.             'MULTI' => 'font-style: italic; color: #669900;',
  11.             0 => 'font-style: italic; color: #009933;',
  12.             1 => 'font-style: italic; color: #9977BB;',
  13.             ),
  14.         'ESCAPE_CHAR' => array(
  15.             0 => ''
  16.             ),
  17.         'BRACKETS' => array(
  18.             0 => 'color: #FF0000; font-weight: bold;'
  19.             ),
  20.         'STRINGS' => array(
  21.             0 => 'font-weight: bold; color: #9977BB;'
  22.             ),
  23.         'NUMBERS' => array(
  24.             0 => 'color: #AC00A9; font-style: italic; font-weight: bold;'
  25.             ),
  26.         'METHODS' => array(
  27.             1 => 'color: #0000FF; font-style: italic; font-weight: bold;'
  28.             ),
  29.         'SYMBOLS' => array(
  30.             0 => 'color: #FF0000; font-weight: bold;'
  31.             ),
  32.         'REGEXPS' => array(
  33.             0 => 'font-weight: bold; color: #AA0000;'
  34.             ),

autohotkey.php
Code: PHP [Select]
  1. 'KEYWORDS' => array(
  2.             1 => 'color: #AAAAFF; font-weight: bold;',       // reserved #blue
  3.             2 => 'color: #88FF88;',                         // BIV yellow
  4.             3 => 'color: #FF00FF; font-style: italic;',       // commands purple
  5.             4 => 'color: #888844; font-weight: bold;',       // functions #0080FF
  6.             5 => 'color: #000000; font-style: italic;',    // directives #black
  7.             6 => 'color: #FF0000; font-style: italic;',      // hotkeys #red
  8.             7 => 'color: #000000; font-style: italic;',    // gui commands #black
  9.             8 => 'color: #000000; font-style: italic;'      // gui controls
  10.             ),
  11.         'COMMENTS' => array(
  12.             'MULTI' => 'font-style: italic; color: #669900;',
  13.             1 => 'font-style: italic; color: #009933;'
  14.             ),
  15.         'ESCAPE_CHAR' => array(
  16.             0 => ''
  17.             ),
  18.         'BRACKETS' => array(
  19.             0 => 'color: #00FF00; font-weight: bold;'
  20.             ),
  21.         'STRINGS' => array(
  22.             0 => 'font-weight: bold; color: #008080;'
  23.             ),
  24.         'NUMBERS' => array(
  25.             0 => 'color: #0000dd;'
  26.             ),
  27.         'METHODS' => array(
  28.             1 => 'color: #0000FF; font-style: italic; font-weight: italic;'
  29.             ),
  30.         'SYMBOLS' => array(
  31.             0 => 'color: #000000; font-weight: italic;'
  32.             ),
  33.         'REGEXPS' => array(
  34.             0 => 'font-weight: italic; color: #A00A0;',
  35.             1 => 'color: #CC0000; font-style: italic;',
  36.             2 => 'color: #DD0000; font-style: italic;',
  37.             3 => 'color: #88FF88;'
  38.             ),

Perhaps the following would work as a change:

Code: PHP [Select]
  1. 'KEYWORDS' => array(
  2.             1 => 'color: #0000FF; font-weight: bold;', // reserved
  3.             2 => 'color: #800000; font-weight: bold;', // BIV
  4.             3 => 'color: #000080; font-style: italic; font-weight: bold;', // commands
  5.             4 => 'color: #0080FF; font-style: italic; font-weight: bold;', // functions
  6.             5 => 'color: #F000FF; font-style: italic;', // directives
  7.             6 => 'color: #FF0000; font-style: italic;', // hotkeys #red
  8.             7 => 'color: #000000; font-style: italic;', // gui commands #black
  9.             8 => 'color: #000000; font-style: italic;'  // gui controls
  10.             ),
  11.         'COMMENTS' => array(
  12.             'MULTI' => 'font-style: italic; color: #669900;',
  13.             1 => 'font-style: italic; color: #009933;'
  14.             ),
  15.         'ESCAPE_CHAR' => array(
  16.             0 => ''
  17.             ),
  18.         'BRACKETS' => array(
  19.             0 => 'color: #FF0000; font-weight: bold;'
  20.             ),
  21.         'STRINGS' => array(
  22.             0 => 'font-weight: bold; color: #9977BB;'
  23.             ),
  24.         'NUMBERS' => array(
  25.             0 => 'color: #AC00A9; font-style: italic; font-weight: bold;'
  26.             ),
  27.         'METHODS' => array(
  28.             1 => 'color: #0000FF; font-style: italic; font-weight: bold;'
  29.             ),
  30.         'SYMBOLS' => array(
  31.             0 => 'color: #FF0000; font-weight: italic;'
  32.             ),
  33.         'REGEXPS' => array(
  34.             0 => 'font-weight: italic; color: #A00A0;',
  35.             1 => 'color: #CC0000; font-style: italic;',
  36.             2 => 'color: #DD0000; font-style: italic;',
  37.             3 => 'color: #88FF88;'
  38.             ),

It looks like autohotkey.php groups 'while', 'if', 'else', and 'return' separately from commands though they are listed as commands in the AHK docs.

Also, autohotkey.php doesn't appear to mention 'static', 'global', 'local', or 'ByRef'.

Perhaps it's worth checking out the content of Extras\Editors\Syntax\...
« Last Edit: June 02, 2010, 12:19 AM by ewemoa »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #10 on: June 02, 2010, 06:57 PM »
i've uploaded ewemoa's modification -- the colors look a lot better now.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #11 on: June 02, 2010, 07:09 PM »
Here are some sample shots:

geshi-ahk-changes-1.pngAutohotkey added to geshi syntax highlighting feature on forum

geshi-ahk-changes-2.pngAutohotkey added to geshi syntax highlighting feature on forum

geshi-ahk-changes-3.pngAutohotkey added to geshi syntax highlighting feature on forum

Note: colors were not the only things changed -- some additions (e.g. global, local, etc were missing) and deletions (e.g. there was both a While and a while, so I removed the latter -- and similar things) were made too.  Perhaps discussion with the author of autohotkey.php might be worthwhile...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #12 on: June 03, 2010, 12:15 AM »
Agreed, that's a helluva lot better.  Thanks, ewemoa & mouser.

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #13 on: June 03, 2010, 01:48 AM »
lovely. any idea if i can port this to notepad++ without lots of editing?

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #14 on: June 03, 2010, 04:33 AM »
Sorry, no idea.

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #15 on: June 03, 2010, 04:56 AM »
Sorry, no idea.
okay, thanks. i'll see if i can figure it out.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #16 on: June 03, 2010, 05:55 AM »
maybe this could help with AHK syntax highlighting in Notepad++.

http://www.autohotke...iewtopic.php?t=58792

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #17 on: June 03, 2010, 06:13 AM »
Interesting find, lanux128  :up:

I tried it out:

ahk-externel-lexer-sample.pngAutohotkey added to geshi syntax highlighting feature on forum

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #18 on: June 03, 2010, 06:54 AM »
i've got some kind of autohotkey syntax highlighting currently working in Notepad++ but it doesn't look like the image above. it must have been from a different ahk forum thread, so i'll try the one you've mentioned, lanux128.

i'm almost happy with the one i'm using but it doesn't appear to know when to colour match curly braces { }.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #19 on: June 03, 2010, 06:58 AM »
thanks, ewemoa. do you use Notepad++ as well? for editors with well formed syntax highlighters, one could try SciTE4AutoHotkey, PSPad or Notepad2 but NPP is slowly getting there.. :)


@nudone: this is a newer version, tweaked by the uploader from that thread because as he put it, "I am a notepad++ user and was totally disappointed with the userDefined.xml lexer because it has certain limitations that the user cant overcome, and on top of that adding a language is a pain."  you should try it.. :)

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #20 on: June 03, 2010, 07:44 AM »
found the one i'm using: http://www.autohotke...orum/topic53288.html

www.autohotkey.com__NppSynHL.png

not tried anything else yet.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #21 on: June 03, 2010, 04:17 PM »
thanks, ewemoa. do you use Notepad++ as well?
What comes to mind at the moment, concerning my Notepad++ usage is:

  • Replacing across multiple files via regular expressions
  • Quick view of a file

further off-topic details
For the former, it's been pretty good with occasional crashing -- unfortunately, I haven't managed to figure out conditions for reproducing this reliably.  It'd be nice for it to do previewing with interactive replacement -- may be it does, and I haven't figured this out.

For the quick-file-viewing, it happens to be fast enough for quick start up here, so it's what I have as a default viewer when using Coffee.

Although a number of other editors with syntax highlighting start up comparably fast (if not faster, e.g. SciTE.exe), I don't think I've tried one that offers both of the above features.

It certainly would be nicer if Notepad++ offered out-of-the-box support for AutoHotkey!

For longer sessions I tend to use Emacs or Code::Blocks -- and if I happen to be using something like Cygwin or MSYS, I tend to use whatever comes up via vi.


for editors with well formed syntax highlighters, one could try SciTE4AutoHotkey
Thanks for the SciTE4AutoHotkey link!  When I looked this time, I spotted the portable version, so may be I will give it a try.  Somehow I had the impression that there wasn't a portable version so I had not tried it before.  Reminds me of the potential value of continuing to check for some things -- things change, and things can be missed ;)

I have tried PSPad and Notepad2 as well.  The former I had various difficulties with so when Notepad++ appeared on the radar...The latter I didn't end up using enough to give a fair assessment.

Update: Saw the following text regarding the non-zip download for SciTE4AutoHotkey:

Despite being an installer, the installation can be portable (uncheck the default editor box).

Sounds nice  :up:
« Last Edit: June 03, 2010, 05:55 PM by ewemoa »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Autohotkey added to geshi syntax highlighting feature on forum
« Reply #22 on: June 03, 2010, 05:29 PM »
Thanks for the SciTE4AutoHotkey link!  When I looked this time, I spotted the portable version, so may be I will give it a try.
I have tried it now.  It looks quite interesting.

Unfortunately...
I haven't come up with a good way for the SciTE4AutoHotkey directory to not have it live inside the directory containing AutoHotkey.exe.  Editing of .properties files seems to be one approach though the toolbar ones (.ini-file like) don't reference ahk.properties (non-ini file which is where AutoHotkeyDir is defined).  I'm not sure whether these changes will survive upgrades...

It also seems that I'd need 2 installations -- one for AHK and one for AHK_L :(


Update: Sorry, forgot to post some shots of the highlighting (below is what I got by default):

scite4ahk-sample-1.pngAutohotkey added to geshi syntax highlighting feature on forum

scite4ahk-sample-2.pngAutohotkey added to geshi syntax highlighting feature on forum

scite4ahk-sample-3.pngAutohotkey added to geshi syntax highlighting feature on forum

Now for some with the included psp style:

scite4ahk-sample-4.pngAutohotkey added to geshi syntax highlighting feature on forum

scite4ahk-sample-5.pngAutohotkey added to geshi syntax highlighting feature on forum

scite4ahk-sample-6.pngAutohotkey added to geshi syntax highlighting feature on forum
« Last Edit: June 03, 2010, 06:27 PM by ewemoa »