Page 1 of 1

#Include lib\*.ahk

Posted: 26 Apr 2017, 17:54
by JJohnston2
Is it possible to include all function libraries in the lib\ folder via a single include statement somehow?

For a few scripts I am calling functions via fn.call() where I want to automatically include libraries. Since the function isn't explicitly referenced, the include statements have to list the libraries individually.

For example, passing in a function

lib1_myFunc() requires #Include <lib1> at the end of the file
lib2_myFunc() requires #Include <lib2> at the end of the file

What I would like is #Include <*.ahk> or something similar.

Currently what's happening is that if I add a new library or call a function in a library that's not referenced, then it can't find it (as expected), but that means a lot of manually adding libraries to the include list every time I have a new or updated lib filename.

Re: #Include lib\*.ahk  Topic is solved

Posted: 27 Apr 2017, 03:32
by Guest
You could prepare a launch script, that prepares and include-file, which is #include-d in your main script.

Launch scripts loops *.ahk generating

Code: Select all

#include lib1.ahk
#include lib2.ahk
#include lib3.ahk
; etc
than you only include that file in your main script (so it only has one #include)

(also check out https://autohotkey.com/board/topic/2028 ... mework-10/ just in case)

Re: #Include lib\*.ahk

Posted: 03 May 2017, 23:42
by JJohnston2
Already had a launcher running for the scripts that needed this, so this solution worked quite nicely without having to add very much... thanks.