Suggested File/Folder Structure for AHK

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Verdlin
Posts: 63
Joined: 04 Oct 2013, 08:55
Contact:

Suggested File/Folder Structure for AHK

25 Oct 2013, 16:57

The following question is directed towards more senior AHK users: what is your suggested file/folder structure for AHK, given my goals?

Note: It is important to note that I am an AutoHotkey_H user.

As I have become more involved with the language, my ahk files have ballooned into a hard-to-manage form. I have certain standards that I do my best to keep when it comes to writing my own scripts and releasing them, but it feels like my goals conflict with my standards.

My current folder structure is bad, and this has become evident in two ways: one, whenever I download a stable, frequently-used script, I usually have to modify the includes to get it working. Secondly, there have been several "bug reports" from me to HotKeyIt that turned out, in short, to be due to my poor folder structure (sorry HotKeyIt!).

This post is somewhat lengthy, but I am doing my best to openly share my thoughts and reflections on proper standards any AHK developer should take, and I am looking for criticism from more senior developers.

Below are my current goals.

Goals:
  • Scripts I write must work when run from any directory; so includes must use relative paths, and assumptions need to be made about the locations of AutoHotkey[Mini].dll/exe -- is this a bad idea? The real goal here is to make the scripts easy for other users to incorporate into their own scripts
  • Keep downloaded scripts that I did not write separate from scripts that I did write, except for when I am packaging scripts (explained below)
  • Structure my files in such a way the GitHub may seamlessly download/upload from those directories
  • Package scripts so that they must be released as standalone .zips that will work "out of the box."
  • Have a little update script that downloads the latest _H, extracts it, and updates my current AHK files -- I can write this script, but it doesn't work well with my current folder structure because I current have multiple copies of AutoHotkey[Mini].dll/exe
Current folder structure of AutoHotKey (64w):
  • Compiler
  • lib
  • other_scripts
    • My own scripts go in here...
  • Win32a
    • other_scripts
    • My own scripts go in here...
  • packages
    • Packaged scripts (working OOB) go in here...
Summary of conflicting goals and file structures:
  • Lib files, although convenient, make it tricky for the packaged scripts to work properly. I tend to put whatever I can in lib, but the problem with this is that my scripts then require many std lib dependencies, and that seems to discourage people from testing my scripts -- perhaps this is just a poor choice on my part to put files in my std lib? I hate having so many folders with duplicate scripts though...is there perhaps a happy medium? Or do I need to face the fact that, given my goals, this is the price I have to pay.
  • Compiling issues. Given my current structure, this is a big issue. Do I set working directory to A_ScriptDir? Right now, I am. But then the problem arises whenever I want to use AutoHotkey[Mini].dlls, I have to reference parent directories (I think A_AhkPath and A_AhkExe solves this issue, but should this have even been an issue?)
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: Suggested File/Folder Structure for AHK

26 Oct 2013, 00:15

My folder structure: (Bold denotes directory)
A_MyDocuments\AutoHotkey
  • Lib ; User library
  • Tools ; Other users' scripts
  • Name-of-script-Name-of-author ; naming format
  • Projects ; My projects/scripts
  • Name-of-project
  • Lib ; dependencies. Even if script(s) exists in StdLib or UserLib, I still make a copy in the project's local Lib
MyProject.ahk
  • Temp ; Temporary stuff
Verdlin
Posts: 63
Joined: 04 Oct 2013, 08:55
Contact:

Re: Suggested File/Folder Structure for AHK

30 Oct 2013, 19:42

Thanks, Coco! This suggests I should bite the bullet and make copies of project's dependencies instead of localize everything into stdlib or relative path includes.
User avatar
trismarck
Posts: 506
Joined: 30 Sep 2013, 01:48
Location: Poland

Re: Suggested File/Folder Structure for AHK

01 Nov 2013, 10:55

I do it just like Coco, I don't even have Temp / Tools folders. Instead, I place 'tags'/a datestamp in the name of the folder.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Suggested File/Folder Structure for AHK

01 Nov 2013, 14:57

My Structure:
Desktop:
All my Scripts
lib:
All my Includes

It worked well until now.
Recommends AHK Studio

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 338 guests