Page 1 of 1

What are some best practices for keeping script neat?

Posted: 24 Oct 2019, 18:11
by A_Perry_1984
This is more of a general question than AHK specific. I would like to post some of my scripts for others to use, but would like them to be more polished. I have been writing scripts off and on for a while, but I have never really figured out a best practice for keeping my scripts readable and organized. What are some recommended practices from the experienced? Examples: Where do I put functions, glabels, variables, comments for easy viewing ETC?

Re: What are some best practices for keeping script neat?  Topic is solved

Posted: 25 Oct 2019, 07:41
by Lichtathlet
I split ahk files by function and include them in a master file.

eg.
custom settings

#include browser.ahk
#include word.ahk
#include excel.ahk

Of course there are some limitations when it comes to global variables etc.
So far it works out well for me.

Re: What are some best practices for keeping script neat?

Posted: 25 Oct 2019, 09:03
by Sid4G
If they don't know much scripting, separating functions in different files will only make it more difficult to understand.
It's best to sort everything logically and add comments, what everything does and what is safe to change and how to do it.