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: 342
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: 6502
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

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

11 Jul 2015, 10:35

Very nice, AutoHotkey prettify :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
SL5
Posts: 342
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: 6502
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
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 :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
jNizM
Posts: 2329
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] 1.1.30.00 x64 Unicode | [WIN] 10 Pro (Version 1803) x64 | [GitHub] Profile
Donations are appreciated if I could help you
User avatar
SL5
Posts: 342
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: 12
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: 342
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: 342
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;
    });

Return to “Other Utilities & Resources”

Who is online

Users browsing this forum: No registered users and 4 guests