online converter: converts your autohotkey code into pretty indented source code.

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

online converter: converts your autohotkey code into pretty indented source code.

11 Jul 2015, 07:40

:wave: online converter for converting your autohotkey code into pretty indented source code.
free no registration needed.

do you like it? please leave feedback :think:

http://sl5.it/SL5_preg_contentFinder/ex ... e_code.php
User avatar
joedf
Posts: 8589
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

11 Jul 2015, 10:35

Very nice, AutoHotkey prettify :)
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

14 Jul 2015, 13:57

joedf wrote:Very nice, AutoHotkey prettify :)
Thanks makes me happy :P

BTW its Lite (online) Version of (offline) https://github.com/sl5net/SL5_AHK_Refac ... ce.php#L60
So if you want try this by yourself :shh: no prob
Last edited by SL5 on 14 Jul 2015, 20:33, edited 1 time in total.
User avatar
joedf
Posts: 8589
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

14 Jul 2015, 15:08

Oh cool haha, I'll try out this real soon :)
User avatar
jNizM
Posts: 3096
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

15 Jul 2015, 00:57

Cool cool...

My suggestions:

- Add braces option (braces with control statement / braces on own line)

Code: Select all

while (x = y) {
    something()
    somethingelse()
}

Code: Select all

while (x = y)
{
    something()
    somethingelse()
}
- Space / Tab intent (2, 3, 4 spaces or 1 tab)
- Space before conditional: if(x) / if (x)

Like the JavaScript beautifier I use
[AHK] v2.0-beta.15 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

15 Jul 2015, 15:01

.
Last edited by SL5 on 16 Jul 2015, 16:50, edited 1 time in total.
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

16 Jul 2015, 16:47

have added two new Style. Two of the three seem to work pretty stablil. I have switched the style SL5net_small_v0.1 as standard for the offline version. next days i need care of another programming language. See you soon!

results:
http://sl5.it/SL5_preg_contentFinder/ex ... e_code.php

Code: Select all

; thats SL5net_small Version 0.1 Indent-Style
if(doIt)
{
    if(doIt)
    {
        if ( next )
            Check
        else
            Check = 5
        if ( next )
        {
            Send,5b{Right 5}
        }}}

Code: Select all

; thats SL5net_small+ NotRecommended Indent-Style
if(doIt){
    if(doIt){
        if ( next )Check
        else
            Check = 5
        if ( next ){
            Send,5b{Right 5}
        }}}
(hopefully also soon visible inside wikipedia: https://de.wikipedia.org/w/index.php?ti ... small-Stil )

Code: Select all

; thats free Indent-Style - like SL5net_small it dosent change the signature or body begin. your free to do it manually ;)
if(doIt)
{
    if(doIt)
    {
        if ( next )
            Check
        else
            Check = 5
        if ( next )
        {
            Send,5b{Right 5}
        }
    }
}
In addition, you can now adjust indentation and switch between space and tab. In addition, your form data is stored on your computer with garlic.js, so you do not need make every new settings.
samzz
Posts: 33
Joined: 31 Jan 2014, 17:47

Re: online converter: converts your autohotkey code into pretty indented source code.

13 Nov 2016, 16:11

Hello,
Very nice tool SL5. I used it to indent the source code of my old script.exe. I extracted the flat/raw code source (not comment, no indentation) with Resource Hacker http://www.angusj.com/resourcehacker/. Just a comment about the result of this tool:
The line command (just) after this IF test is indented, so it's fine.

Code: Select all

If (0<Ct)
But the line (just) after this IF test is not indented, and it should be indented. I guess because the test contains parenthesis and/or quotes.

Code: Select all

If (0<InStr(LisO,Labl . "/"))
Is it possible to download this tool to use it offline? How?
Maybe you can fix this "bug". Thanks in advance and regards.
sam
Last edited by samzz on 13 Nov 2016, 17:32, edited 1 time in total.
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

13 Nov 2016, 17:00

samzz wrote: ...
Is it possible to download this tool to use it offline? How?
Maybe you can fix this "bug". Thanks in advance and regards.
sam
download it here: https://github.com/sl5net/SL5_preg_cont ... Source.php

of use eventually (slightly different) for e.g. use STRG + SHIFT + L
with https://github.com/sl5net/SL5_AHK_Refactor_engine
Last edited by SL5 on 21 Apr 2018, 21:57, edited 2 times in total.
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

21 Apr 2018, 21:37

if you want to simulate this similar or slightly different. This is the abridged version of the core PHP source code. the main responsible part (from https://github.com/sl5net/SL5_preg_cont ... Source.php ).

Code: Select all

<?php
include_once("SL5_preg_contentFinder.php");
.....
$cf = new SL5_preg_contentFinder($file_content);
$cf->setBeginEnd_RegEx($old_open, $old_close);
$cf->setSearchMode('dontTouchThis');

$actual = $cf->getContent_user_func_recursive(

    function ($cut, $deepCount, $callsCount, $posList0, $source1) use ($conf, $arguments, $new_open_default, $new_close_default, $charSpace, $newline, $indentSize, $getIndentStr) {
        if ($cut['middle'] === false) return $cut;
        $indentStr = $getIndentStr(1, $charSpace, $indentSize);

        if (!isset($posList0['begin_end'])) $posList0['begin_end'] = strlen($source1);

        $start = '' . substr($source1, $posList0['begin_begin'], $posList0['begin_end'] - $posList0['begin_begin']) . '';
        $end = '' . ltrim(substr($source1, $posList0['end_begin'], $posList0['end_end'] - $posList0['end_begin'])) . '';

        if ($conf['noNewlineAtEnd']) {
            $doNoNewlineAtEnd = preg_match("/\W[}\s]*\}\R*$/ms", $cut['middle'], $m);
            if ($doNoNewlineAtEnd) 
                $cut['middle'] = rtrim($cut['middle']) . '';
        }
        $cut['middle'] = implode($newline . '' . $indentStr, preg_split("/(\R)/m", $cut['middle']));

        $cut['middle'] = '' . rtrim($start) . '' . $newline . '' .
            $indentStr . '' . trim($cut['middle']) . '';
        if ($conf['noNewlineAtEnd'] && $doNoNewlineAtEnd) {
            $cut['middle'] .= $end . '' . $cut['behind'] . '';
        } else {
            $cut['middle'] .= $newline . '' . $end . '' . $cut['behind'] . '';
        }
        return $cut;
    });
MarcelDeZaadcel
Posts: 15
Joined: 27 Nov 2020, 04:31

Re: online converter: converts your autohotkey code into pretty indented source code.

04 Jan 2021, 07:26

SL5 wrote:
11 Jul 2015, 07:40
:wave: online converter for converting your autohotkey code into pretty indented source code.
free no registration needed.

do you like it? please leave feedback :think:

http://sl5.it/SL5_preg_contentFinder/examples/AutoHotKey/converts_your_autohotkey_code_into_pretty_indented_source_code.php

Some bugs when adjusting "{"
Last edited by BoBo on 31 Mar 2021, 16:35, edited 1 time in total.
Reason: Fixed broken link.
User avatar
Chunjee
Posts: 1230
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: online converter: converts your autohotkey code into pretty indented source code.

31 Mar 2021, 12:31

What needs to happen to get this working inside VisualStudioCode?

I put a checkmark on "use Tab for indent?" but it still uses spaces.
User avatar
joedf
Posts: 8589
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: online converter: converts your autohotkey code into pretty indented source code.

31 Mar 2021, 13:28

@Chunjee
It looks like that's just the preview? :think:
The "Pretty indented code" seems to have tab characters when enabled.
lancelot
Posts: 9
Joined: 12 May 2021, 11:05

Re: online converter: converts your autohotkey code into pretty indented source code.

24 Nov 2021, 05:08

Seems buggy to me - I use the http://hilite.me/ one because this one always messes up my code. I am guessing it's one of those tools that used to work and doesn't anymore?
UserNameForAH_Board
Posts: 44
Joined: 02 Jan 2018, 15:55

Re: online converter: converts your autohotkey code into pretty indented source code.

28 Feb 2022, 12:59

But I find that there is this web tool, called (perhaps) 'SL5', and which uses, er, a tool that seems written for another language. Except, er: I find also that the web tool mangles my Autohotkey code!
lancelot
Posts: 9
Joined: 12 May 2021, 11:05

Re: online converter: converts your autohotkey code into pretty indented source code.

28 Feb 2022, 13:24

UserNameForAH_Board wrote:
28 Feb 2022, 12:53
hilite.me converts code into . . HTML.
sort of - you're missing the point - if you look at the preview instead of the code it's formatted your line breaks and indentations
jmuhammad
Posts: 2
Joined: 10 Sep 2022, 00:49

Re: online converter: converts your autohotkey code into pretty indented source code.

10 Sep 2022, 01:07

Greetings SL5,
First, thanks for writing AHK Prettyfy;
Second, how can I set the ELSE statements to be followed by curly brackets on their own line (Allman Indentation style)?

Like from:

Code: Select all

If (...)
{
  ;Statement
}else  {
  ;Statement
}
to this:

Code: Select all

If (...)
{
  ;Statement
}
else
{
  ;Statement
}
User avatar
thqby
Posts: 197
Joined: 16 Apr 2021, 11:18
GitHub: thqby

Re: online converter: converts your autohotkey code into pretty indented source code.

13 Sep 2022, 01:57

image.png
image.png (80.02 KiB) Viewed 1017 times
For AHK2, you can do this by using VSCode Web and setting the formatter option one_true_brace to false.

Return to “Other Utilities & Resources”

Who is online

Users browsing this forum: No registered users and 1 guest