What are some best practices for keeping script neat? Topic is solved
-
- Posts: 76
- Joined: 07 Dec 2018, 12:08
What are some best practices for keeping script neat?
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?
-
- Posts: 6
- Joined: 14 Oct 2019, 07:54
Re: What are some best practices for keeping script neat? Topic is solved
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.
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?
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.
It's best to sort everything logically and add comments, what everything does and what is safe to change and how to do it.