#include file cannot be opened

Get help with using AutoHotkey and its commands and hotkeys
Posts: 21
Joined: 13 Jan 2014, 10:47

#include file cannot be opened

16 Dec 2014, 01:35

I have a problem that makes absolutely no sense.

I keep my ahk scripts on OneDrive and everything works perfect on PC, but once I sync to my laptop I can't compile, getting error "#include file cannot be opened".
Ok, so I thought there must be something wrong with OneDrive folder, and I moved the script on Desktop, but I get the same error.
So I made a simple test script to see if it compiles, which it does, and then step by step I brought the non-compiling script to the same structure as the test script, and I still get the error.
I even brought the script back on the PC and I still get the error.

All systems have AHK_L

I've attached the scripts below, where "New folder" is the test script, which compiles, and "New folder1" is the script from OneDrive folder edited to the same structure as the test script.

Both scripts are identical, why does one compile and the other doesn't ?
(2.45 KiB) Downloaded 60 times
Posts: 502
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: #include file cannot be opened

16 Dec 2014, 17:03

I've had a similar problem. I keep my scripts in a Dropbox folder and if I compile a script which has #include, sometimes the specified file is not included. I have surmised that there can be some interaction between the compiler and Dropbox that makes the included file not available at times.

Repeating the compile usually works.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Posts: 6742
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: #include file cannot be opened

17 Dec 2014, 02:35

Thank you for providing sample files. In fact, the files are identical, but the folders are not. ;)

The problem in this case is that Ahk2Exe uses FileExist incorrectly, and fails to recognize the lib in #include lib as a directory if the directory has other attributes, like the Archive attribute.

Code: Select all

if FileExist(IncludeFile) = "D"
should be

Code: Select all

if InStr(FileExist(IncludeFile), "D")
To work around the bug, remove the Archive attribute from the folder.

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, Google [Bot], jamesldnaylor, omareg94, swagfag, teadrinker and 224 guests